Revision: 201039
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 02:28:24 +0300
changeset 74 9d35fd98f273
parent 69 dc67b94625c5
Revision: 201039 Kit: 201039
accessoryservices/accessorymonitor/tsrc/public/basic/accmonitoringtestmodule/group/accMonitoringTestModule.mmp
accessoryservices/accessorymonitor/tsrc/public/basic/accmonitoringtestmodule/tests/group/accMonitoringTestModule_exe.mmp
accessoryservices/accessoryremotecontrol/tsrc/remcontestcontrol/dsytfstifadapter/group/dsytfstifadapter.mmp
accessoryservices/accessoryserver/inc/Common/AccClientServerMessages.h
accessoryservices/accessoryserver/src/Client/AccessoryServer.cpp
accessoryservices/accessoryserver/tsrc/public/basic/AccessoryTestControl/dsytfstifadapter/group/dsytfstifadapter.mmp
accessoryservices/headsetstatusapi/tsrc/public/basic/headsettestmodule/group/headsetTestModule.mmp
accessoryservices/pluggeddisplay/edidparser/group/edidparser.mmp
accessoryservices/pluggeddisplay/pluggeddisplayasy/group/pluggeddisplayasy.mmp
accessoryservices/pluggeddisplay/pluggeddisplayengine/group/pluggeddisplayengine.mmh
accessoryservices/pluggeddisplay/pluggeddisplayengine/group/pluggeddisplayengine.mmp
accessoryservices/pluggeddisplay/pluggeddisplayengine/src/accessorycontrolif.cpp
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/group/bld.inf
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/group/tvoutconfig.mmp
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutconfigimp.h
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutconfigstatuscontrol.h
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutstubeventlistener.h
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/rom/tvoutconfig_stub.iby
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/src/tvoutconfigimp.cpp
accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/src/tvoutstubeventlistener.cpp
accessoryservices/remotecontrolfw/bearerplugin/public/remconbearerinterface.h
accessoryservices/remotecontrolfw/client/bld.inf
accessoryservices/remotecontrolfw/client/common/remconbulkclient.h
accessoryservices/remotecontrolfw/client/common/remconclient.h
accessoryservices/remotecontrolfw/client/inner/bwins/remconclientU.DEF
accessoryservices/remotecontrolfw/client/inner/eabi/remconclientU.DEF
accessoryservices/remotecontrolfw/client/inner/src/session.cpp
accessoryservices/remotecontrolfw/client/sidekeyapi/bwins/remconsidekeyapiu.def
accessoryservices/remotecontrolfw/client/sidekeyapi/eabi/remconsidekeyapiu.def
accessoryservices/remotecontrolfw/client/sidekeyapi/group/bld.inf
accessoryservices/remotecontrolfw/client/sidekeyapi/group/remconsidekeyapi.mmp
accessoryservices/remotecontrolfw/client/sidekeyapi/inc/remconsidekeyapipaniccodes.h
accessoryservices/remotecontrolfw/client/sidekeyapi/public/remconsidekeyapi.h
accessoryservices/remotecontrolfw/client/sidekeyapi/public/remconsidekeytarget.h
accessoryservices/remotecontrolfw/client/sidekeyapi/public/remconsidekeytargetobserver.h
accessoryservices/remotecontrolfw/client/sidekeyapi/src/sidekeytarget.cpp
accessoryservices/remotecontrolfw/common/remconserver.h
accessoryservices/remotecontrolfw/server/group/remconserver.mmp
accessoryservices/remotecontrolfw/server/inc/activehelper.h
accessoryservices/remotecontrolfw/server/inc/bearermanager.h
accessoryservices/remotecontrolfw/server/inc/controllersession.h
accessoryservices/remotecontrolfw/server/inc/controllersession.inl
accessoryservices/remotecontrolfw/server/inc/messagesendobserver.h
accessoryservices/remotecontrolfw/server/inc/server.h
accessoryservices/remotecontrolfw/server/inc/session.h
accessoryservices/remotecontrolfw/server/inc/targetclientprocess.h
accessoryservices/remotecontrolfw/server/inc/targetclientprocess.inl
accessoryservices/remotecontrolfw/server/inc/targetsession.h
accessoryservices/remotecontrolfw/server/public/remconserverpanic.h
accessoryservices/remotecontrolfw/server/src/activehelper.cpp
accessoryservices/remotecontrolfw/server/src/bearermanager.cpp
accessoryservices/remotecontrolfw/server/src/controllersession.cpp
accessoryservices/remotecontrolfw/server/src/server.cpp
accessoryservices/remotecontrolfw/server/src/session.cpp
accessoryservices/remotecontrolfw/server/src/targetclientprocess.cpp
accessoryservices/remotecontrolfw/server/src/targetsession.cpp
accessoryservices/tspclientmapper/tsrc/public/basic/tspclienttestmodule/group/tspclienttestmodule.mmp
commonservices/PlatformEnv/disknotifyhandler/tsrc/disknotifyhandlertest/group/disknotifyhandlertest.mmp
commonservices/PlatformEnv/platformver/tsrc/platformvertest/group/platformvertest.mmp
commonservices/PlatformEnv/sysversioninfo/tsrc/sysutiltests/group/sysutiltests.mmp
commonservices/PlatformEnv/tsrc/platformenvtest/group/PlatformEnvTest.mmp
devicesrv_plat/accessory_plugin_api/inc/ASYCommandHandlerBase.h
devicesrv_plat/accessory_plugin_api/inc/ASYMainServiceBase.h
devicesrv_plat/dos_extension_api/inc/dossvrservices.h
devicesrv_pub/accessory_monitoring_api/tsrc/bc/accmonapibctests/group/AccMonAPIBCTests.mmp
devicesrv_pub/platform_environment_api/tsrc/bc/platformenv/group/PlatformEnvTest.mmp
devicesrv_pub/sensor_channel_api/tsrc/sensor/group/sensortest.mmp
devicesrv_pub/sensor_data_compensator_api/tsrc/sensordatacompensatortest/group/sensordatacompensatortest.mmp
devicesrv_pub/version_info_api/tsrc/bc/platformvertest/group/platformvertest.mmp
dosservices/tsrc/dsytesttool/dsytfstifadapter/group/dsytfstifadapter.mmp
hwrmhaptics/hapticsclient/src/hwrmhapticssession.cpp
mediator/tsrc/public/basic/group/MediatorTest.mmp
psmservices/psmserver/tsrc/PsmTestModule/group/PsmTestModule.mmp
resourcemgmt/hwresourcesmgr/include/HWRMPowerStateSDKPSKeys.h
resourcemgmt/hwresourcesmgr/power/inc/HWRMPower.h
resourcemgmt/hwresourcesmgr/power/src/HWRMChargingStatusObserver.cpp
resourcemgmt/hwresourcesmgr/power/src/HWRMPowerImpl.cpp
resourcemgmt/hwresourcesmgr/server/inc/HWRMPowerStatePluginHandler.h
resourcemgmt/hwresourcesmgr/server/plugininc/HWRMPowerCommands.h
resourcemgmt/hwresourcesmgr/server/src/HWRMPowerStatePluginHandler.cpp
resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtest.cpp
resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtest.h
resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtestbase.cpp
resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtestbase.h
resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_fmtx.script
resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_light.script
resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_power.script
resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_power_ext_charging_info.script
resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_vibra.script
resourcemgmt/hwrmtargetmodifierplugin/tsrc/hwrmtargetmodifierplugintest/group/hwrmtargetmodifierplugintest.mmp
sensorservices/orientationssy/data/10282F0F.RSS
sensorservices/orientationssy/inc/SsyConfiguration.h
sensorservices/sensordatacompensator/tsrc/sensordatacompensatortest/group/sensordatacompensatortest.mmp
sensorservices/sensorserver/tsrc/sensorsrvtest/SensorTestModule/group/SensorTestModule.mmp
sysstatemgmt/ssmcmdlists/data/failcmdlist.rss
sysstatemgmt/systemstateplugins/cmncustomcmd/bwins/cmncustomcmdsu.def
sysstatemgmt/systemstateplugins/cmncustomcmd/eabi/cmncustomcmdsu.def
sysstatemgmt/systemstateplugins/cmncustomcmd/group/bld.inf
sysstatemgmt/systemstateplugins/cmncustomcmd/group/cmncustomcmds.mmp
sysstatemgmt/systemstateplugins/cmncustomcmd/inc/cmdpersistreboots.h
sysstatemgmt/systemstateplugins/cmncustomcmd/inc/cmdpersistreboots.hrh
sysstatemgmt/systemstateplugins/cmncustomcmd/src/cmdpersistreboots.cpp
sysstatemgmt/systemstateplugins/cmncustomcmd/src/ssmcmncustomcmdfactory.cpp
sysstatemgmt/systemstateplugins/gsapolicy/bwins/gsastatepolicystartupu.def
sysstatemgmt/systemstateplugins/gsapolicy/eabi/gsastatepolicystartupu.def
sysstatemgmt/systemstateplugins/gsapolicy/group/bld.inf
sysstatemgmt/systemstateplugins/gsapolicy/group/gsastatepolicystartup.mmp
sysstatemgmt/systemstateplugins/gsapolicy/inc/cmdpersistreboots.rh
sysstatemgmt/systemstateplugins/gsapolicy/inc/gsastatepolicystartup.h
sysstatemgmt/systemstateplugins/gsapolicy/inc/ssmmaxbootattempts_patch.h
sysstatemgmt/systemstateplugins/gsapolicy/resource/gsanormalcmdlist.rss
sysstatemgmt/systemstateplugins/gsapolicy/src/gsastatepolicystartup.cpp
sysstatemgmt/systemstateplugins/gsapolicy/src/ssmmaxbootattempts_patch.cpp
sysstatemgmt/systemstateplugins/test/tappgsapolicy/group/sspluginstest_tappgsapolicy.mmp
sysstatemgmt/systemstateplugins/test/tappgsapolicy/resource/gsastartupcmdlist7_target.rss
sysstatemgmt/systemstateplugins/test/tappgsapolicy/src/sspluginstest_tappgsapolicy.cpp
sysstatemgmt/systemstateplugins/test/tcmncustomcmd/group/tcmncustomcmd_server.mmp
sysstatemgmt/systemstateplugins/test/tcmncustomcmd/inc/tcmncustomcmd_step_persistreboots.h
sysstatemgmt/systemstateplugins/test/tcmncustomcmd/scripts/sspluginstest_cmncustomcmd_persistreboots.script
sysstatemgmt/systemstateplugins/test/tcmncustomcmd/scripts/sspluginstest_cmncustomcmd_run.bat
sysstatemgmt/systemstateplugins/test/tcmncustomcmd/src/tcmncustomcmd_server.cpp
sysstatemgmt/systemstateplugins/test/tcmncustomcmd/src/tcmncustomcmd_step_persistreboots.cpp
sysstatemgmt/systemstateplugins/test/tunitgsapolicy/group/tgsa_server.mmp
sysstatemgmt/systemstateplugins/test/tunitgsapolicy/src/tgsa_step_normal.cpp
sysstatemgmt/systemstateplugins/test/tunitgsapolicy/src/tgsa_step_startup.cpp
sysstatemgmt/tsrc/public/basic/group/mt_rstartersession.mmp
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0033_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0034_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0035_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0036_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0037_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0038_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0039_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0040_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0041_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0042_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0043_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0044_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0045_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0046_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0047_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0048_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0049_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0054_emulator0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0035_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0036_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0037_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0039_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0040_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0041_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0042_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0045_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0046_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0047_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0048_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0049_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0054_hardware0.rss
systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-eiof_hardware0.rss
--- a/accessoryservices/accessorymonitor/tsrc/public/basic/accmonitoringtestmodule/group/accMonitoringTestModule.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/accessorymonitor/tsrc/public/basic/accmonitoringtestmodule/group/accMonitoringTestModule.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -40,7 +40,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         accclient.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         accmonitor.lib
 LIBRARY         AccMonConnectionEmulator.lib
 LIBRARY         accmontesttimer.lib
--- a/accessoryservices/accessorymonitor/tsrc/public/basic/accmonitoringtestmodule/tests/group/accMonitoringTestModule_exe.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/accessorymonitor/tsrc/public/basic/accmonitoringtestmodule/tests/group/accMonitoringTestModule_exe.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -33,7 +33,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 
 SMPSAFE
 
--- a/accessoryservices/accessoryremotecontrol/tsrc/remcontestcontrol/dsytfstifadapter/group/dsytfstifadapter.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/accessoryremotecontrol/tsrc/remcontestcontrol/dsytfstifadapter/group/dsytfstifadapter.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -47,7 +47,7 @@
 // Dependencies to system components
 LIBRARY         euser.lib
 LIBRARY         dsytfcore.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 
 //MACRO           COMPONENT_TRACE_FLAG
 
--- a/accessoryservices/accessoryserver/inc/Common/AccClientServerMessages.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/accessoryserver/inc/Common/AccClientServerMessages.h	Mon Oct 04 02:28:24 2010 +0300
@@ -32,7 +32,7 @@
 
 // The number of message slots available.
 // This determines the maximum number of outstanding requests.
-const TUint KDefaultMessageSlots       = 8;
+const TUint KDefaultMessageSlots       = 12;
 
 // Message parameter psoitions
 const TUint8 KAccServParamPosFirst     = 0;
--- a/accessoryservices/accessoryserver/src/Client/AccessoryServer.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/accessoryserver/src/Client/AccessoryServer.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -76,11 +76,12 @@
 			}
 		// Wait until the completion of the server creation
 		User::WaitForRequest( status );
-		if( status != KErrNone )
-			{
-			server.Close();
-			return status.Int();
-			}
+			
+		// We can't use the 'exit reason' if the server paniced as this
+		// is the panic 'reason' and may be '0' which cannot be distinguished
+		// from KErrNone
+		ret = (server.ExitType() == EExitPanic)? KErrGeneral : status.Int();
+			
 		// Server created successfully
 		server.Close(); // we're no longer interested in the other process
 		}
--- a/accessoryservices/accessoryserver/tsrc/public/basic/AccessoryTestControl/dsytfstifadapter/group/dsytfstifadapter.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/accessoryserver/tsrc/public/basic/AccessoryTestControl/dsytfstifadapter/group/dsytfstifadapter.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -47,7 +47,7 @@
 // Dependencies to system components
 LIBRARY         euser.lib
 LIBRARY         dsytfcore.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 
 //MACRO           COMPONENT_TRACE_FLAG
 
--- a/accessoryservices/headsetstatusapi/tsrc/public/basic/headsettestmodule/group/headsetTestModule.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/headsetstatusapi/tsrc/public/basic/headsettestmodule/group/headsetTestModule.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -40,7 +40,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         HeadsetStatus.lib
 
 LANG            SC
--- a/accessoryservices/pluggeddisplay/edidparser/group/edidparser.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/edidparser/group/edidparser.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -37,4 +37,6 @@
 
 OS_LAYER_SYSTEMINCLUDE
 
-LIBRARY                 euser.lib
\ No newline at end of file
+LIBRARY                 euser.lib
+
+SMPSAFE
--- a/accessoryservices/pluggeddisplay/pluggeddisplayasy/group/pluggeddisplayasy.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayasy/group/pluggeddisplayasy.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -48,3 +48,6 @@
 LIBRARY			ecom.lib
 LIBRARY			asyproxy.lib
 LIBRARY			pluggeddisplayengine.lib
+
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/group/pluggeddisplayengine.mmh	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,4 @@
+//
+// Enable the following macro includes the DDC and TVOUTCONFIG stubs
+//
+// #define PDE_USE_HWSTUBS
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/group/pluggeddisplayengine.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/group/pluggeddisplayengine.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -20,6 +20,7 @@
 #include <data_caging_paths.hrh>
 
 #include "../inc/traceconfiguration.hrh"
+#include "pluggeddisplayengine.mmh"
 
 TARGET                  pluggeddisplayengine.dll
 TARGETTYPE              dll
@@ -55,8 +56,6 @@
 SYSTEMINCLUDE       	/epoc32/include/platform/mw
 
 LIBRARY                 euser.lib
-LIBRARY         		tvoutconfig.lib
-LIBRARY					ddc_access.lib
 LIBRARY					accpolaudiodevicetopology.lib
 LIBRARY					accpolicy.lib
 LIBRARY					accsrvutil.lib
@@ -68,7 +67,18 @@
 LIBRARY					fbscli.lib
 LIBRARY					sysutil.lib
 
+#ifndef PDE_USE_HWSTUBS
+LIBRARY         		TvOutConfig.lib
+LIBRARY					ddc_access.lib
+#else
+LIBRARY         		tvoutconfig_stub.lib
+LIBRARY					ddc_access_stub.lib
+#endif
+
 #ifdef TRACE_INTO_FILE
 LIBRARY					flogger.lib
 #endif
 
+
+
+SMPSAFE
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/accessorycontrolif.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/accessorycontrolif.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -81,7 +81,7 @@
         CAccConfigFileParser* accConfigFileParser =
             CAccConfigFileParser::NewL( _L("Configuration file") );
         CleanupStack::PushL( accConfigFileParser );
-        if ( !iGenericIDPtr )
+        if ( iGenericIDPtr )
             {
             delete iGenericIDPtr;
             iGenericIDPtr = NULL;
@@ -369,6 +369,7 @@
     iFSM( aFSM )
     {
     FUNC_LOG;
+    iGenericIDPtr = NULL;
     }
 
 // ---------------------------------------------------------
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/group/bld.inf	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/group/bld.inf	Mon Oct 04 02:28:24 2010 +0300
@@ -23,6 +23,7 @@
 
 PRJ_TESTEXPORTS
 ../inc/tvoutconfigstatuscontrol.h	OS_LAYER_PLATFORM_EXPORT_PATH( tvoutconfigstatuscontrol.h )
+../rom/tvoutconfig_stub.iby                    CORE_OS_LAYER_IBY_EXPORT_PATH(tvoutconfig_stub.iby)
 
 PRJ_TESTMMPFILES
 tvoutconfig.mmp
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/group/tvoutconfig.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/group/tvoutconfig.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -19,7 +19,7 @@
 #include <platform_paths.hrh>
 #include <data_caging_paths.hrh>
 
-TARGET              tvoutconfig.dll
+TARGET              tvoutconfig_stub.dll
 TARGETTYPE          dll
 
 UID                 0x1000008D 0x101F6E00
@@ -37,3 +37,10 @@
 MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
+LIBRARY			acccontrol.lib
+LIBRARY			accpolicy.lib
+LIBRARY			accsrvutil.lib
+LIBRARY			accclient.lib
+
+
+SMPSAFE
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutconfigimp.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutconfigimp.h	Mon Oct 04 02:28:24 2010 +0300
@@ -24,6 +24,8 @@
 
 #include <e32base.h>
 #include <e32def.h>
+#include <AccessoryServer.h>
+#include <AccessoryControl.h>
 #include "tvoutconfig.h"
 #include "tvoutstubeventsender.h"
 
@@ -113,6 +115,9 @@
     
     TTvSettings iTvSettings;
     
+		TBool iCVideoConnected;
+		TInt iPreviousEvent;
+    
     // Let the following two be the last fields. It is used to 
     // check compatibility between creator of this chunk (structure)
     // and other users
@@ -120,8 +125,7 @@
         {
         TUint iSizeOfThisStruct;
         TUint8   iTag[ 10 ];
-        } iBinaryProtection;
-    
+        } iBinaryProtection;    
     };
 
 /**
@@ -186,6 +190,7 @@
     private:
 
 		void EventHdmiCableConnect( const TInt aArg );
+		void EventAnalogCableConnect( const TInt aArg );
 
 	    void EventCopyProtectionStatus( const TInt aArg );
 	    
@@ -252,7 +257,21 @@
 		RArray<TSupportedHdmiDviMode> iAllDviMode;
 		RArray<TSupportedHdmiDviMode> iSupportedMode;
 		
-    };
+	    /** Accessory server client */
+	    RAccessoryServer iAccServer;
+	    
+	    /** Accessory control */
+	    RAccessoryControl iAccControl;
+		
+	    /** C-Video accessory generic ID */
+	    TAccPolGenericID iCVideoGenericID;
+		
+		/**
+		 * Cable connection status listener
+		 *
+		 */
+		CTVOutStubEventListener* iAnalogCableConnectStatusListener;
+	};
 
 #endif //__TVOUTCONFIGIMP_H__
 
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutconfigstatuscontrol.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutconfigstatuscontrol.h	Mon Oct 04 02:28:24 2010 +0300
@@ -35,6 +35,7 @@
 const TUint32 KTVOutStatusControlCopyProtect  = 0x00000005; // Set to 0 for "Copy Ptotection off", 1 for "Copy Ptotection on"
 const TUint32 KTVOutStatusControlConfigChange = 0x00000006; // Change this value to indicate that TV Out stting has changed
 const TUint32 KTVOutStatusControlConfigChangeImmediateError = 0x00000007; // CTvOutConfig::SettingsChangedListener() should fail immediately with this code.
+const TUint32 KTVOutStatusControlAnalogCableConnect = 0x00000008;
 
 // Set to update the Supported CEA mode
 // 0 - All CEA modes defined in TFixedModeCea are supported
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutstubeventlistener.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/inc/tvoutstubeventlistener.h	Mon Oct 04 02:28:24 2010 +0300
@@ -104,6 +104,8 @@
     TUid iCategory;
     
     TUint iKey;
+    
+    TInt iPreviousValue;
 
     };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/rom/tvoutconfig_stub.iby	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  DDC Access Stub ROM files.
+*
+*/
+
+#ifndef TVOUTCONFIG_IBY
+#define TVOUTCONFIG_IBY
+
+file=ABI_DIR\BUILD_DIR\tvoutconfig_stub.dll                 sys\bin\tvoutconfig_stub.dll
+
+#endif // TVOUTCONFIG_IBY
+// End of File
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/src/tvoutconfigimp.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/src/tvoutconfigimp.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -22,6 +22,10 @@
 #include "tvoutstubeventlistener.h"
 
 #include <e32std.h>
+#include <AccPolGenericIdDefinitions.h>
+#include <AccPolCommonNameValuePairs.h>
+#include <AccConfigFileParser.h>
+#include <AccConGenericID.h>
 #include "trace.h"
 
 //- External Data -----------------------------------------------------------
@@ -50,7 +54,6 @@
     CTvOutConfig(), iHdmiCableListenerStatus( NULL )
     {
     FUNC_LOG;
-
     }
 
 //---------------------------------------------------------------------------
@@ -60,9 +63,14 @@
 CTvOutConfigImp::~CTvOutConfigImp()
     {
     FUNC_LOG;
+	
+    iAccControl.CloseSubSession();
+    iAccServer.Close();
+	
     iConfigurationChunk.Close();
     iConfigSemaphore.Close();
     delete iCableConnectStatusListener;
+	delete iAnalogCableConnectStatusListener;
     delete iCopyProtectStatusListener;
     delete iSettingChangeListener;
 	iAllDviMode.Reset();
@@ -136,6 +144,12 @@
         KTVOutStatusControlCableConnect,
         RProperty::EInt );
     RProperty::Define( KTVOutStatusControlCategory,
+        KTVOutStatusControlAnalogCableConnect,
+        RProperty::EInt );
+    RProperty::Define( KTVOutStatusControlCategory,
+        KTVOutStatusControlCableConnect,
+        RProperty::EInt );
+    RProperty::Define( KTVOutStatusControlCategory,
         KTVOutStatusControlConfigChange,
         RProperty::EInt );
     
@@ -167,6 +181,9 @@
         KTVOutStatusControlCableConnect,
         0 );
     RProperty::Set( KTVOutStatusControlCategory,
+        KTVOutStatusControlAnalogCableConnect,
+        0 );
+    RProperty::Set( KTVOutStatusControlCategory,
         KTVOutStatusControlConfigChange,
         0 ); 
     RProperty::Set( KTVOutStatusControlCategory,
@@ -182,6 +199,9 @@
     iCableConnectStatusListener = CTVOutStubEventListener::NewL( *this,
         KTVOutStatusControlCategory,
         KTVOutStatusControlCableConnect );
+    iAnalogCableConnectStatusListener = CTVOutStubEventListener::NewL( *this,
+        KTVOutStatusControlCategory,
+        KTVOutStatusControlAnalogCableConnect );
     iCopyProtectStatusListener = CTVOutStubEventListener::NewL( *this,
         KTVOutStatusControlCategory,
         KTVOutStatusControlCopyProtect );
@@ -209,6 +229,11 @@
 		mode.iStandardMode = i;
 		iAllDviMode.Append( mode );
 		}
+
+    err = iAccServer.Connect();
+	User::LeaveIfError( err );
+	err = iAccControl.CreateSubSession( iAccServer );
+	User::LeaveIfError( err );
     }
 
 //---------------------------------------------------------------------------
@@ -850,7 +875,14 @@
     const TInt aArg )
     {
     FUNC_LOG;
-    if( KTVOutStatusControlCategory == aCategory )
+    /*TInt previousevent = KErrNone;
+    
+    iConfigSemaphore.Wait();
+    previousevent = iConfig->iPreviousEvent;
+    iConfig->iPreviousEvent = aEvent;
+    iConfigSemaphore.Signal();*/
+    
+    if( (KTVOutStatusControlCategory == aCategory) ) //&& (previousevent != aEvent) )
         {
         if( KTVOutStatusControlCableConnect == aEvent )
             {
@@ -864,7 +896,11 @@
             {
             EventSettingChange( aArg );       
             }
-        }
+		else if( KTVOutStatusControlAnalogCableConnect == aEvent )
+			{
+			EventAnalogCableConnect( aArg );
+			}
+        }        
     }
 
 //---------------------------------------------------------------------------
@@ -894,6 +930,137 @@
 
 //---------------------------------------------------------------------------
 /**
+ Process Analog cable connect event
+
+ */
+
+void CTvOutConfigImp::EventAnalogCableConnect( const TInt aArg )
+	{
+    FUNC_LOG;
+    TBool cvideoconnected = EFalse;
+    
+    RProcess process;
+    TSecureId KRequiredSecureId((TUint32)0x10205030);
+
+    if( process.SecureId() != KRequiredSecureId )
+    	{
+    		INFO_1("***************It is NOT Accessory server thread - 0x%x", (TUint32)process.SecureId());
+    		return;
+    	}
+ 		INFO_1("*************It is Accessory server thread - 0x%x", (TUint32)process.SecureId());
+        
+/*   TSecureId accid((TUint32)0x10205030);
+    TSecureId secid = User::CreatorSecureId();
+    
+    if( secid != accid )
+    	{
+    		INFO_1("***************It is NOT Accessory server thread - 0x%x", (TUint32)secid);
+    		return;
+    	}
+ 		INFO_1("*************It is Accessory server thread - 0x%x", (TUint32)secid);
+ 		*/
+    	
+    iConfigSemaphore.Wait();
+    cvideoconnected = iConfig->iCVideoConnected;
+    
+    if( aArg && (!cvideoconnected) )
+        {
+        // Connected
+		TInt err = KErrNone;
+		
+		CAccConfigFileParser* accConfigFileParser = CAccConfigFileParser::NewL(
+			_L("Configuration file") );
+		CleanupStack::PushL( accConfigFileParser );
+		
+		CAccConGenericID* genericID = CAccConGenericID::NewL();
+		CleanupStack::PushL( genericID );
+		
+		RArray<TAccPolNameValueRecord> nameValueArray;
+		CleanupClosePushL( nameValueArray );
+		TBuf<KHWModelIDMaxLength> hwModelID( _L("c-video") );
+		TAccPolNameRecord nameRecord;
+		TAccPolValueRecord valueRecord;
+		
+		TBuf<KHWModelIDMaxLength> HWModelID( _L("c-video") );
+		
+		//Set GenericID header
+		TAccPolGIDHeader genericIdHeader;
+		genericIdHeader.iAccessoryDeviceType = KDTAVDevice;
+		genericIdHeader.iPhysicalConnection = KPCWired;
+		genericIdHeader.iApplicationProtocol = 0x0;
+		genericIdHeader.iCapabilitiesSubblocks = KSBAudioSubblock | KSBVideoSubblock;
+		genericIdHeader.iHWModelID = hwModelID;
+		genericIdHeader.iHWDeviceID = 0x0;
+		
+		//Set "Audio Output Type" capability
+		TAccPolNameValueRecord
+			nameValueRecordAudioOutputType( KAccAudioOutputType,
+				EAccAudioOutPutTypePublic,
+				EAPVInt,
+				EAPVPolicy );
+		nameValueArray.AppendL( nameValueRecordAudioOutputType );
+		
+		//Set "Audio stereo" capability
+		TAccPolNameValueRecord nameValueRecordAudioStereo( KAccStereoAudio,
+			EAccAudioOutPutTypePublic,
+			EAPVInt,
+			EAPVPolicy );
+		nameValueArray.AppendL( nameValueRecordAudioStereo );
+		
+		//Set "Line out Type" capability
+		TAccPolNameValueRecord nameValueRecordAudioOut( KAccAudioOut,
+			TAccAudioOutLineout,
+			EAPVInt,
+			EAPVPolicy );
+		nameValueArray.AppendL( nameValueRecordAudioOut );
+		
+		//Set "Video Output Type" capability
+		TAccPolNameValueRecord nameValueRecordVideoOut( KAccVideoOut,
+			EAccVideoOutCVideo,
+			EAPVInt,
+			EAPVPolicy );
+		nameValueArray.AppendL( nameValueRecordVideoOut );
+		
+		accConfigFileParser->ParseGenericIDL( genericID,
+			genericIdHeader,
+			nameValueArray );
+		
+    //iConfigSemaphore.Wait();
+    iConfig->iCVideoConnected = ETrue;
+    //iConfigSemaphore.Signal();
+    
+		TRequestStatus status;
+		iAccControl.ConnectAccessory( status, genericID, EFalse );
+		User::WaitForRequest( status );
+		err = status.Int();
+
+		if( KErrNone == err )
+			{
+			iCVideoGenericID = genericID->GenericID();
+			}
+			
+			// Cleanup
+			CleanupStack::PopAndDestroy( &nameValueArray );
+			CleanupStack::PopAndDestroy( genericID );
+			CleanupStack::PopAndDestroy( accConfigFileParser );
+        }
+    else if( (!aArg) && cvideoconnected )
+        {
+        // Disconnected
+    //iConfigSemaphore.Wait();
+    iConfig->iCVideoConnected = EFalse;
+    //iConfigSemaphore.Signal();
+    
+	    TRequestStatus status;
+	    iAccControl.DisconnectAccessory( status, iCVideoGenericID );
+	    User::WaitForRequest( status );
+		}
+    iConfigSemaphore.Signal();
+
+	}
+
+//---------------------------------------------------------------------------
+/**
  Process Copy Protection status event
 
  */
--- a/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/src/tvoutstubeventlistener.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/pluggeddisplay/tsrc/stubs/tvoutconfig/src/tvoutstubeventlistener.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -18,6 +18,7 @@
 #include "tvoutconfigstatuscontrol.h"
 #include "tvoutstubeventlistener.h"
 #include "tvoutstubeventsender.h"
+#include "trace.h"
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -27,7 +28,7 @@
 //
 CTVOutStubEventListener::CTVOutStubEventListener( MTVOutStubEventSender& aSender )
   : CActive( EPriorityStandard ),
-    iSender( aSender )
+    iSender( aSender ), iPreviousValue(-1)
     {
     CActiveScheduler::Add( this );
     }
@@ -97,7 +98,21 @@
 
         if ( errorCode == KErrNone )
             {
-            iSender.SendEvent( iCategory, iKey, value );
+            	RProcess process;
+            	
+            	INFO_3("**EVENT received for 0x%x PREV=%d CURR=%d", (TUint32)process.SecureId(), iPreviousValue, value );
+            if( (iKey == KTVOutStatusControlCableConnect) || (iKey == KTVOutStatusControlAnalogCableConnect) )
+            	  {
+            	  	if( iPreviousValue != value )
+            	  		{
+            				iSender.SendEvent( iCategory, iKey, value );
+            			  }
+            	  }
+            else
+            	{
+            		iSender.SendEvent( iCategory, iKey, value );
+            	}
+            iPreviousValue = value;
             }
         }
 
--- a/accessoryservices/remotecontrolfw/bearerplugin/public/remconbearerinterface.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/bearerplugin/public/remconbearerinterface.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -307,6 +307,17 @@
 				irrespective of how many controller sessions support that interface.
 	*/
 	virtual void ControllerFeaturesUpdated(RArray<TUid>& aSupportedInterfaces) = 0;
+	
+	/**
+	Called by RemCon when a target client registers new interfaces after being made available.
+
+	@param aId The target client that has regitered new interfaces.
+	@param aPlayerType The basic type of this client after registration of new interfaces.
+	@param aPlayerSubType More detailed type information on this client after registration of new interfaces.
+	@param aName The name of this client in UTF-8. This remains valid until ClientNotAvailable 
+				 is called for this player.
+	*/
+	virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) = 0;
 	};
 
 #endif // REMCONBEARERINTERFACE_H
--- a/accessoryservices/remotecontrolfw/client/bld.inf	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/client/bld.inf	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -24,3 +24,4 @@
 #include "intermediate/group/bld.inf"
 #include "coreapi/group/bld.inf"
 #include "extapi1/group/bld.inf"
+#include "sidekeyapi/group/bld.inf"
--- a/accessoryservices/remotecontrolfw/client/common/remconbulkclient.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/client/common/remconbulkclient.h	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -31,7 +31,7 @@
 /**
 The abstract base class for RemCon session handles.
 */
-class RRemConBulk : public RSessionBase
+NONSHARABLE_CLASS(RRemConBulk) : public RSessionBase
 	{
 public:
 	IMPORT_C RRemConBulk();
--- a/accessoryservices/remotecontrolfw/client/common/remconclient.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/client/common/remconclient.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -34,7 +34,7 @@
 /**
 The abstract base class for RemCon session handles.
 */
-class RRemCon : public RSessionBase
+NONSHARABLE_CLASS(RRemCon) : public RSessionBase
 	{
 public:
 	/**
@@ -47,17 +47,17 @@
 	/**
 	Connect the handle to the server.
 	Must be called before all other methods (except Version and Close).
-	@param aClientType  The type of client player
-	@param aClientSubType The sub-type of the client player
+	@param aPlayerType  The type of client player
+	@param aPlayerSubType The sub-type of the client player
 	@param aName The name of client player
 	@return Error.
 	*/
-	IMPORT_C TInt Connect(const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName);
+	IMPORT_C TInt Connect(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName);
 	/**
 	Getter for the version of the server.
 	@return Version of the server.
 	*/
-	IMPORT_C TVersion Version() const;
+	virtual TVersion Version() const = 0;
 
 	/**
 	Sends a message (command or response) to the remote device.
@@ -203,8 +203,7 @@
 
 private: // utility
 	TInt DoConnect();
-	TInt SetClientType();
-	TInt SetClientType(const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName);
+	TInt SetPlayerType(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName);
 
 private: // owned
 	const TRemConClientType iClientType;
@@ -251,7 +250,7 @@
 connections, or member data in any other way. They operate as pure Symbian OS 
 asynchronous cancel methods.
 */
-class RRemConController : public RRemCon
+NONSHARABLE_CLASS(RRemConController) : public RRemCon
 	{
 public:
 	IMPORT_C RRemConController();
@@ -299,15 +298,25 @@
 	@return KErrNone.
 	*/
 	IMPORT_C TInt DisconnectBearerCancel();
+
+	/** Returns the version of the RemCon server interface this session supports.
+	@return Supported version
+	*/
+	TVersion Version() const;
 	};
 
 /**
 The concrete session class for RemCon targets.
 */
-class RRemConTarget : public RRemCon
+NONSHARABLE_CLASS(RRemConTarget) : public RRemCon
 	{
 public:
 	IMPORT_C RRemConTarget();
+	
+	/** Returns the version of the RemCon server interface this session supports.
+	@return Supported version
+	*/
+	TVersion Version() const;
 	};
 
 #endif // REMCONCLIENT_H
--- a/accessoryservices/remotecontrolfw/client/inner/bwins/remconclientU.DEF	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/client/inner/bwins/remconclientU.DEF	Mon Oct 04 02:28:24 2010 +0300
@@ -3,37 +3,36 @@
 	??0RRemConBulk@@QAE@XZ @ 2 NONAME ; RRemConBulk::RRemConBulk(void)
 	?Receive@RRemCon@@QAEXAAVTRequestStatus@@AAUTRemConClientReceivePackage@@AAVTDes8@@@Z @ 3 NONAME ; void RRemCon::Receive(class TRequestStatus &, struct TRemConClientReceivePackage &, class TDes8 &)
 	?__DbgMarkHeap@RRemCon@@QAEHXZ @ 4 NONAME ; int RRemCon::__DbgMarkHeap(void)
-	?Version@RRemCon@@QBE?AVTVersion@@XZ @ 5 NONAME ; class TVersion RRemCon::Version(void) const
-	?DisconnectBearerCancel@RRemConController@@QAEHXZ @ 6 NONAME ; int RRemConController::DisconnectBearerCancel(void)
-	?Receive@RRemConBulk@@QAEXAAVTRequestStatus@@AAVTUid@@AAIAAVTDes8@@@Z @ 7 NONAME ; void RRemConBulk::Receive(class TRequestStatus &, class TUid &, unsigned int &, class TDes8 &)
-	?SendCancel@RRemConBulk@@QAEHXZ @ 8 NONAME ; int RRemConBulk::SendCancel(void)
-	?ReceiveCancel@RRemConBulk@@QAEHXZ @ 9 NONAME ; int RRemConBulk::ReceiveCancel(void)
-	?ReceiveCancel@RRemCon@@QAEHXZ @ 10 NONAME ; int RRemCon::ReceiveCancel(void)
-	?Send@RRemConBulk@@QAEXAAVTRequestStatus@@VTUid@@IABVTDesC8@@@Z @ 11 NONAME ; void RRemConBulk::Send(class TRequestStatus &, class TUid, unsigned int, class TDesC8 const &)
-	?ConnectBearerCancel@RRemConController@@QAEHXZ @ 12 NONAME ; int RRemConController::ConnectBearerCancel(void)
-	?NotifyConnectionsChange@RRemCon@@QAEXAAVTRequestStatus@@@Z @ 13 NONAME ; void RRemCon::NotifyConnectionsChange(class TRequestStatus &)
-	?__DbgMarkEnd@RRemConBulk@@QAEHH@Z @ 14 NONAME ; int RRemConBulk::__DbgMarkEnd(int)
-	?RegisterInterestedAPIs@RRemCon@@QAEHABVTDesC8@@@Z @ 15 NONAME ; int RRemCon::RegisterInterestedAPIs(class TDesC8 const &)
-	?SendUnreliable@RRemConBulk@@QAEHVTUid@@IABVTDesC8@@@Z @ 16 NONAME ; int RRemConBulk::SendUnreliable(class TUid, unsigned int, class TDesC8 const &)
-	?Connect@RRemCon@@QAEHXZ @ 17 NONAME ; int RRemCon::Connect(void)
-	?Connect@RRemConBulk@@QAEHXZ @ 18 NONAME ; int RRemConBulk::Connect(void)
-	?DisconnectBearer@RRemConController@@QAEXAAVTRequestStatus@@@Z @ 19 NONAME ; void RRemConController::DisconnectBearer(class TRequestStatus &)
-	?GetConnections@RRemCon@@QAEHAAV?$TSglQue@VTRemConAddress@@@@@Z @ 20 NONAME ; int RRemCon::GetConnections(class TSglQue<class TRemConAddress> &)
-	?Connect@RRemCon@@QAEHABW4TPlayerType@@ABW4TPlayerSubType@@ABVTDesC8@@@Z @ 21 NONAME ; int RRemCon::Connect(enum TPlayerType const &, enum TPlayerSubType const &, class TDesC8 const &)
-	?Version@RRemConBulk@@QBE?AVTVersion@@XZ @ 22 NONAME ; class TVersion RRemConBulk::Version(void) const
-	?ConnectBearer@RRemConController@@QAEXAAVTRequestStatus@@@Z @ 23 NONAME ; void RRemConController::ConnectBearer(class TRequestStatus &)
-	??0RRemConTarget@@QAE@XZ @ 24 NONAME ; RRemConTarget::RRemConTarget(void)
-	?GoConnectionless@RRemConController@@QAEHXZ @ 25 NONAME ; int RRemConController::GoConnectionless(void)
-	?__DbgFailNext@RRemCon@@QAEHH@Z @ 26 NONAME ; int RRemCon::__DbgFailNext(int)
-	?__DbgFailNext@RRemConBulk@@QAEHH@Z @ 27 NONAME ; int RRemConBulk::__DbgFailNext(int)
-	?SendCancel@RRemCon@@QAEHXZ @ 28 NONAME ; int RRemCon::SendCancel(void)
-	?GoConnectionOriented@RRemConController@@QAEHABVTRemConAddress@@@Z @ 29 NONAME ; int RRemConController::GoConnectionOriented(class TRemConAddress const &)
-	?Send@RRemCon@@QAEXAAVTRequestStatus@@VTUid@@IAAIW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 30 NONAME ; void RRemCon::Send(class TRequestStatus &, class TUid, unsigned int, unsigned int &, enum TRemConMessageSubType, class TDesC8 const &)
-	?NotifyConnectionsChangeCancel@RRemCon@@QAEHXZ @ 31 NONAME ; int RRemCon::NotifyConnectionsChangeCancel(void)
-	?__DbgMarkHeap@RRemConBulk@@QAEHXZ @ 32 NONAME ; int RRemConBulk::__DbgMarkHeap(void)
-	?SendNotify@RRemCon@@QAEXAAVTRequestStatus@@VTUid@@IW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 33 NONAME ; void RRemCon::SendNotify(class TRequestStatus &, class TUid, unsigned int, enum TRemConMessageSubType, class TDesC8 const &)
-	?SendUnreliable@RRemCon@@QAEHVTUid@@IW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 34 NONAME ; int RRemCon::SendUnreliable(class TUid, unsigned int, enum TRemConMessageSubType, class TDesC8 const &)
-	?__DbgMarkEnd@RRemCon@@QAEHH@Z @ 35 NONAME ; int RRemCon::__DbgMarkEnd(int)
-	??0RRemConController@@QAE@XZ @ 36 NONAME ; RRemConController::RRemConController(void)
-	?__DbgCheckHeap@RRemCon@@QAEHH@Z @ 37 NONAME ; int RRemCon::__DbgCheckHeap(int)
+	?DisconnectBearerCancel@RRemConController@@QAEHXZ @ 5 NONAME ; int RRemConController::DisconnectBearerCancel(void)
+	?Receive@RRemConBulk@@QAEXAAVTRequestStatus@@AAVTUid@@AAIAAVTDes8@@@Z @ 6 NONAME ; void RRemConBulk::Receive(class TRequestStatus &, class TUid &, unsigned int &, class TDes8 &)
+	?SendCancel@RRemConBulk@@QAEHXZ @ 7 NONAME ; int RRemConBulk::SendCancel(void)
+	?ReceiveCancel@RRemConBulk@@QAEHXZ @ 8 NONAME ; int RRemConBulk::ReceiveCancel(void)
+	?ReceiveCancel@RRemCon@@QAEHXZ @ 9 NONAME ; int RRemCon::ReceiveCancel(void)
+	?Send@RRemConBulk@@QAEXAAVTRequestStatus@@VTUid@@IABVTDesC8@@@Z @ 10 NONAME ; void RRemConBulk::Send(class TRequestStatus &, class TUid, unsigned int, class TDesC8 const &)
+	?ConnectBearerCancel@RRemConController@@QAEHXZ @ 11 NONAME ; int RRemConController::ConnectBearerCancel(void)
+	?NotifyConnectionsChange@RRemCon@@QAEXAAVTRequestStatus@@@Z @ 12 NONAME ; void RRemCon::NotifyConnectionsChange(class TRequestStatus &)
+	?__DbgMarkEnd@RRemConBulk@@QAEHH@Z @ 13 NONAME ; int RRemConBulk::__DbgMarkEnd(int)
+	?RegisterInterestedAPIs@RRemCon@@QAEHABVTDesC8@@@Z @ 14 NONAME ; int RRemCon::RegisterInterestedAPIs(class TDesC8 const &)
+	?SendUnreliable@RRemConBulk@@QAEHVTUid@@IABVTDesC8@@@Z @ 15 NONAME ; int RRemConBulk::SendUnreliable(class TUid, unsigned int, class TDesC8 const &)
+	?Connect@RRemCon@@QAEHXZ @ 16 NONAME ; int RRemCon::Connect(void)
+	?Connect@RRemConBulk@@QAEHXZ @ 17 NONAME ; int RRemConBulk::Connect(void)
+	?DisconnectBearer@RRemConController@@QAEXAAVTRequestStatus@@@Z @ 18 NONAME ; void RRemConController::DisconnectBearer(class TRequestStatus &)
+	?GetConnections@RRemCon@@QAEHAAV?$TSglQue@VTRemConAddress@@@@@Z @ 19 NONAME ; int RRemCon::GetConnections(class TSglQue<class TRemConAddress> &)
+	?Connect@RRemCon@@QAEHABW4TPlayerType@@ABW4TPlayerSubType@@ABVTDesC8@@@Z @ 20 NONAME ; int RRemCon::Connect(enum TPlayerType const &, enum TPlayerSubType const &, class TDesC8 const &)
+	?Version@RRemConBulk@@QBE?AVTVersion@@XZ @ 21 NONAME ; class TVersion RRemConBulk::Version(void) const
+	?ConnectBearer@RRemConController@@QAEXAAVTRequestStatus@@@Z @ 22 NONAME ; void RRemConController::ConnectBearer(class TRequestStatus &)
+	??0RRemConTarget@@QAE@XZ @ 23 NONAME ; RRemConTarget::RRemConTarget(void)
+	?GoConnectionless@RRemConController@@QAEHXZ @ 24 NONAME ; int RRemConController::GoConnectionless(void)
+	?__DbgFailNext@RRemCon@@QAEHH@Z @ 25 NONAME ; int RRemCon::__DbgFailNext(int)
+	?__DbgFailNext@RRemConBulk@@QAEHH@Z @ 26 NONAME ; int RRemConBulk::__DbgFailNext(int)
+	?SendCancel@RRemCon@@QAEHXZ @ 27 NONAME ; int RRemCon::SendCancel(void)
+	?GoConnectionOriented@RRemConController@@QAEHABVTRemConAddress@@@Z @ 28 NONAME ; int RRemConController::GoConnectionOriented(class TRemConAddress const &)
+	?Send@RRemCon@@QAEXAAVTRequestStatus@@VTUid@@IAAIW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 29 NONAME ; void RRemCon::Send(class TRequestStatus &, class TUid, unsigned int, unsigned int &, enum TRemConMessageSubType, class TDesC8 const &)
+	?NotifyConnectionsChangeCancel@RRemCon@@QAEHXZ @ 30 NONAME ; int RRemCon::NotifyConnectionsChangeCancel(void)
+	?__DbgMarkHeap@RRemConBulk@@QAEHXZ @ 31 NONAME ; int RRemConBulk::__DbgMarkHeap(void)
+	?SendNotify@RRemCon@@QAEXAAVTRequestStatus@@VTUid@@IW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 32 NONAME ; void RRemCon::SendNotify(class TRequestStatus &, class TUid, unsigned int, enum TRemConMessageSubType, class TDesC8 const &)
+	?SendUnreliable@RRemCon@@QAEHVTUid@@IW4TRemConMessageSubType@@ABVTDesC8@@@Z @ 33 NONAME ; int RRemCon::SendUnreliable(class TUid, unsigned int, enum TRemConMessageSubType, class TDesC8 const &)
+	?__DbgMarkEnd@RRemCon@@QAEHH@Z @ 34 NONAME ; int RRemCon::__DbgMarkEnd(int)
+	??0RRemConController@@QAE@XZ @ 35 NONAME ; RRemConController::RRemConController(void)
+	?__DbgCheckHeap@RRemCon@@QAEHH@Z @ 36 NONAME ; int RRemCon::__DbgCheckHeap(int)
 
--- a/accessoryservices/remotecontrolfw/client/inner/eabi/remconclientU.DEF	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/client/inner/eabi/remconclientU.DEF	Mon Oct 04 02:28:24 2010 +0300
@@ -38,5 +38,3 @@
 	_ZN7RRemCon7ConnectEv @ 37 NONAME
 	_ZN7RRemCon7ReceiveER14TRequestStatusR27TRemConClientReceivePackageR5TDes8 @ 38 NONAME
 	_ZNK11RRemConBulk7VersionEv @ 39 NONAME
-	_ZNK7RRemCon7VersionEv @ 40 NONAME
-
--- a/accessoryservices/remotecontrolfw/client/inner/src/session.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/client/inner/src/session.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -81,42 +81,23 @@
 	LOG_FUNC
 	}
 
-EXPORT_C TVersion RRemCon::Version() const
-	{
-	LOG_FUNC
-	return(TVersion(	KRemConSrvMajorVersionNumber,
-						KRemConSrvMinorVersionNumber,
-						KRemConSrvBuildNumber
-					)
-			);
-	}
-
 EXPORT_C TInt RRemCon::Connect()
 	{
 	LOG_FUNC
 
 	TInt err = DoConnect();
-	if ( err == KErrNone )
-		{
-		err = SetClientType();
-		if ( err != KErrNone )
-			{
-			// For this API to be clean, we must clean up the session handle 
-			// already successfully created.
-			Close();
-			}
-		}
+
 	return err;
 	}
 
-EXPORT_C TInt RRemCon::Connect(const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName)
+EXPORT_C TInt RRemCon::Connect(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName)
 	{
 	LOG_FUNC
 
 	TInt err = DoConnect();
 	if ( err == KErrNone )	
 		{
-		err = SetClientType(aClientType,aClientSubType,aName);
+		err = SetPlayerType(aPlayerType,aPlayerSubType,aName);
 		if ( err != KErrNone )
 			{
 			// For this API to be clean, we must clean up the session handle 
@@ -167,23 +148,16 @@
 at construction time).
 @return Error.
 */
-TInt RRemCon::SetClientType()
-	{
-	LOG_FUNC
-	return SendReceive(ERemConSetClientType, TIpcArgs(iClientType));
-	}
-
-TInt RRemCon::SetClientType(const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName)
+TInt RRemCon::SetPlayerType(const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName)
 	{
 	LOG_FUNC
 	TIpcArgs args;
-	args.Set(0,iClientType);
-	iPlayerTypePckg().iPlayerType = aClientType;
-	iPlayerTypePckg().iPlayerSubType = aClientSubType;
+	// Message slot 0 is not currently used
+	iPlayerTypePckg().iPlayerType = aPlayerType;
+	iPlayerTypePckg().iPlayerSubType = aPlayerSubType;
 	args.Set(1,&iPlayerTypePckg);
-	args.Set(2,aName.Length());
-	args.Set(3, &aName);
-	return SendReceive(ERemConSetClientType, args);
+	args.Set(2, &aName);
+	return SendReceive(ERemConSetPlayerType, args);
 	}
 
 EXPORT_C TInt RRemCon::SendUnreliable(TUid aInterfaceUid, 
@@ -198,7 +172,7 @@
 	
 	args.Set(0, aInterfaceUid.iUid);
 	args.Set(1, &iOpInfoPckg);
-	args.Set(2, &aData);
+	args.Set(3, &aData);
 	TInt err = SendReceive(ERemConSendUnreliable, args); 
 	return err;
 	}
@@ -495,9 +469,29 @@
 	return KErrNone;
 	}
 
+TVersion RRemConController::Version() const
+	{
+	LOG_FUNC
+	return(TVersion(	KRemConSrvMajorVersionNumber,
+						KRemConSrvMinorVersionNumber,
+						KRemConSrvControllerSession
+					)
+			);
+	}
+
 EXPORT_C RRemConTarget::RRemConTarget()
 :	RRemCon(ERemConClientTypeTarget)
 	{
 	LOG_FUNC
 	}
 
+TVersion RRemConTarget::Version() const
+	{
+	LOG_FUNC
+	return(TVersion(	KRemConSrvMajorVersionNumber,
+						KRemConSrvMinorVersionNumber,
+						KRemConSrvTargetSession
+					)
+			);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/bwins/remconsidekeyapiu.def	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	?SideKeyDownResponse@CRemConSideKeyTarget@@QAEXH@Z @ 1 NONAME ; void CRemConSideKeyTarget::SideKeyDownResponse(int)
+	?NewL@CRemConSideKeyTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConSideKeyTargetObserver@@@Z @ 2 NONAME ; class CRemConSideKeyTarget * CRemConSideKeyTarget::NewL(class CRemConInterfaceSelector &, class MRemConSideKeyTargetObserver &)
+	??1CRemConSideKeyTarget@@UAE@XZ @ 3 NONAME ; CRemConSideKeyTarget::~CRemConSideKeyTarget(void)
+	?SideKeyUpResponse@CRemConSideKeyTarget@@QAEXH@Z @ 4 NONAME ; void CRemConSideKeyTarget::SideKeyUpResponse(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/eabi/remconsidekeyapiu.def	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN20CRemConSideKeyTarget17SideKeyUpResponseEi @ 1 NONAME
+	_ZN20CRemConSideKeyTarget19SideKeyDownResponseEi @ 2 NONAME
+	_ZN20CRemConSideKeyTarget4NewLER24CRemConInterfaceSelectorR28MRemConSideKeyTargetObserver @ 3 NONAME
+	_ZN20CRemConSideKeyTargetD0Ev @ 4 NONAME
+	_ZN20CRemConSideKeyTargetD1Ev @ 5 NONAME
+	_ZN20CRemConSideKeyTargetD2Ev @ 6 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/group/bld.inf	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_MMPFILES
+remconsidekeyapi.mmp
+
+PRJ_EXPORTS
+../public/remconsidekeyapi.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconsidekeyapi.h)
+../public/remconsidekeytarget.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconsidekeytarget.h)
+../public/remconsidekeytargetobserver.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(remcon/remconsidekeytargetobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/group/remconsidekeyapi.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,52 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// remconsidekeyapi.dll An outer layer client side library facilitating 
+// Side Key messages.
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+
+TARGET			remconsidekeyapi.dll //Recommended unpaged
+
+// We need all these caps because we don't know anything about the process 
+// we'll be running in.
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+// UID2 = 0x1000008d for static interface DLLs.
+// UID3 = unique for RemCon system
+UID 			0x1000008d 0x101f9067
+VENDORID		0x70000001
+
+USERINCLUDE 	../inc
+
+
+SOURCEPATH		../src
+SOURCE			sidekeytarget.cpp
+
+
+USERINCLUDE 	../../../common
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY 		euser.lib
+LIBRARY 		remconinterfacebase.lib
+
+#include <bluetooth/btlogger.mmh>
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/inc/remconsidekeyapipaniccodes.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef REMCONSIDEKEYAPIPANICCODES_H
+#define REMCONSIDEKEYAPIPANICCODES_H
+
+enum TSideKeyApiPanicCat
+	{
+	ESideKeyMissingButtonData,
+	ESideKeyInvalidOperationId,
+	};
+
+_LIT(KSideKeyPanicCat,"RemconSideKeyApi");
+
+#endif // REMCONSIDEKEYAPIPANICCODES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/public/remconsidekeyapi.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,70 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef REMCONSIDEKEYAPI_H
+#define REMCONSIDEKEYAPI_H
+
+#include <e32base.h>
+
+/** Offset in the operation-specific data of the 'result' (this field exists 
+in both commands and responses, but logically only applies to responses). */
+const TUint KRemConSideKeyApiResultDataOffset = 0;
+
+/** Length of the results data/field in bytes. */
+const TUint KRemConSideKeyApiResultDataLength = 4;
+
+/** Used for checking operation-specific data. The operation-specific data of 
+an Side Key API message must always contain at least a results field, so the length 
+of the results field is the minimum length of this 'packet'. */
+const TUint KRemConSideKeyApiMinimumDataLength = KRemConSideKeyApiResultDataLength;
+
+/**
+The UID identifying the Side Key outer-layer RemCon interface.
+*/
+const TInt KRemConSideKeyApiUid = 0x2002FF91;
+
+/**
+Operation ids belonging to the Side Key interface.
+These are public so bearers/converters can access them.
+*/
+enum TRemConSideKeyOperationId
+	{
+	/** Side key up pressed. */
+	ERemConSideKeyUp			= 0x00,
+	/** Side key down pressed. */
+	ERemConSideKeyDown			= 0x01,
+	};
+
+/** Length of the button action data in bytes. */
+const TUint KRemConSideKeyApiButtonDataLength = 1;
+
+/** Button actions. */
+enum TRemConSideKeyApiButtonAction
+	{
+	/** A button has been pressed. */
+	ERemConSideKeyApiButtonPress	= 0,
+	/** A button has been released. */
+	ERemConSideKeyApiButtonRelease 	= 1,
+	/** A button has been clicked. */
+	ERemConSideKeyApiButtonClick	= 2,
+	};
+
+#endif // REMCONSIDEKEYAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/public/remconsidekeytarget.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSIDEKEYTARGET_H
+#define REMCONSIDEKEYTARGET_H
+
+#include <e32base.h>
+#include <remcon/remconinterfacebase.h>
+#include <remcon/remconinterfaceif.h>
+
+class MRemConSideKeyTargetObserver;
+class CRemConInterfaceSelector;
+
+/**
+Client-instantiable type supporting sending SideKey API responses.
+*/
+NONSHARABLE_CLASS(CRemConSideKeyTarget) : public CRemConInterfaceBase, 
+								         public MRemConInterfaceIf
+	{
+public:
+	/**
+	Factory function.
+	@param aInterfaceSelector The interface selector. The client must have 
+	created one of these first.
+	@param aObserver The observer of this interface.
+	@return A new CRemConSideKeyTarget, owned by the interface selector.
+	*/
+	IMPORT_C static CRemConSideKeyTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConSideKeyTargetObserver& aObserver);
+	
+	IMPORT_C ~CRemConSideKeyTarget();
+
+public:
+	/**
+	Sends a response to a 'side key up' command.
+	@param aError The response error.
+	*/
+	IMPORT_C void SideKeyUpResponse(TInt aError);
+
+	/**
+	Sends a response to a 'side key down' command.
+	@param aError The response error.
+	*/
+	IMPORT_C void SideKeyDownResponse(TInt aError);
+
+
+private:
+	/** 
+	Constructor.
+	@param aInterfaceSelector The interface selector.
+	@param aObserver The observer of this interface.
+	*/
+	CRemConSideKeyTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+		MRemConSideKeyTargetObserver& aObserver);
+
+private: // from CRemConInterfaceBase
+	TAny* GetInterfaceIf(TUid aUid);
+
+private: // from MRemConInterfaceIf
+	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
+
+private: // unowned
+	MRemConSideKeyTargetObserver& iObserver;
+
+private: // owned
+	// For operation-specific data.
+	static const TUint KMaxOperationDataSize = 0x04;
+	TBuf8<KMaxOperationDataSize> iOutData;
+	};
+
+#endif // REMCONSIDEKEYTARGET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/public/remconsidekeytargetobserver.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+#ifndef REMCONSIDEKEYTARGETOBSERVER_H
+#define REMCONSIDEKEYTARGETOBSERVER_H
+
+#include <e32base.h>
+#include <remcon/remconsidekeyapi.h>
+
+/**
+Client-implemented mixin- notifies the client of incoming SideKey commands.
+*/
+class MRemConSideKeyTargetObserver
+	{
+public:
+	/** 
+	A 'side key up' command has been received.
+	*/
+	virtual void MrcsktoSideKeyUp(TRemConSideKeyApiButtonAction aAction) = 0;
+
+	/** 
+	A 'side key down' command has been received.
+	*/
+	virtual void MrcsktoSideKeyDown(TRemConSideKeyApiButtonAction aAction) = 0;
+	};
+
+#endif // REMCONSIDEKEYTARGETOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/client/sidekeyapi/src/sidekeytarget.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,141 @@
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <bluetooth/logger.h>
+#include <e32base.h>
+#include <remcon/remconsidekeyapi.h>
+#include <remcon/remconsidekeytarget.h>
+#include <remcon/remconsidekeytargetobserver.h>
+#include <remconinterfaceselector.h>
+#include "remconsidekeyapipaniccodes.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "RemconSideKeyApi");
+#endif
+
+#ifdef _DEBUG
+// only called via __ASSERT_DEBUG statements
+static void Panic(TSideKeyApiPanicCat aCode)
+	{
+	User::Panic(KSideKeyPanicCat, aCode);
+	}
+#endif
+
+EXPORT_C CRemConSideKeyTarget* CRemConSideKeyTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, 
+																	MRemConSideKeyTargetObserver& aObserver)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConSideKeyTarget* self = new(ELeave) CRemConSideKeyTarget(aInterfaceSelector, aObserver);
+	CleanupStack::PushL(self);
+	self->BaseConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRemConSideKeyTarget::CRemConSideKeyTarget(CRemConInterfaceSelector& aInterfaceSelector, 
+													 MRemConSideKeyTargetObserver& aObserver)
+:	CRemConInterfaceBase(TUid::Uid(KRemConSideKeyApiUid), 
+						 KMaxOperationDataSize,
+						 aInterfaceSelector,
+						 ERemConClientTypeTarget),
+	iObserver(aObserver)
+	{
+	}
+
+EXPORT_C CRemConSideKeyTarget::~CRemConSideKeyTarget()
+	{
+	LOG_FUNC
+	}
+
+TAny* CRemConSideKeyTarget::GetInterfaceIf(TUid aUid)
+	{
+	LOG_FUNC
+	TAny* ret = NULL;
+	if ( aUid == TUid::Uid(KRemConInterfaceIf1) )
+		{
+		ret = reinterpret_cast<TAny*>(
+			static_cast<MRemConInterfaceIf*>(this)
+			);
+		}
+
+	return ret;
+	}
+
+void CRemConSideKeyTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData)
+	{
+	LOG_FUNC
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	LOG1(_L("\taData.Length = %d"), aData.Length());
+
+	// Get the button action
+	if ( aData.Length() < KRemConSideKeyApiButtonDataLength )
+		{
+		// The bearer sent us incorrect data. We cannot panic the bearer
+		// from here, so we panic ourselves in udeb mode only instead.
+		__ASSERT_DEBUG(EFalse,Panic(ESideKeyMissingButtonData));
+		LOG(_L("\tdropping command because button data not found"));
+		return; // ditch malformed messages
+		}
+	TRemConSideKeyApiButtonAction action = static_cast<TRemConSideKeyApiButtonAction>(aData.Ptr()[0]);
+
+	switch ( aOperationId )
+		{
+	case ERemConSideKeyUp:
+		iObserver.MrcsktoSideKeyUp(action);
+		break;
+
+	case ERemConSideKeyDown:
+		iObserver.MrcsktoSideKeyDown(action);
+		break;
+
+	default:
+		// The bearer sent us incorrect data. We cannot panic the bearer
+		// from here, so we panic ourselves in udeb mode only instead.
+		__ASSERT_DEBUG(EFalse,Panic(ESideKeyInvalidOperationId));
+		break;
+		}
+	}
+
+EXPORT_C void CRemConSideKeyTarget::SideKeyUpResponse(TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConSideKeyApiResultDataLength);
+	
+	InterfaceSelector().SendUnreliable( 
+		TUid::Uid(KRemConSideKeyApiUid), 
+		(TUint)ERemConSideKeyUp, 
+		ERemConResponse,
+		iOutData);
+	}
+
+EXPORT_C void CRemConSideKeyTarget::SideKeyDownResponse(TInt aError)
+	{
+	LOG_FUNC
+
+	iOutData.Copy((TUint8*)&aError, KRemConSideKeyApiResultDataLength);
+	
+	InterfaceSelector().SendUnreliable(
+		TUid::Uid(KRemConSideKeyApiUid), 
+		(TUint)ERemConSideKeyDown, 
+		ERemConResponse,
+		iOutData);
+	}
--- a/accessoryservices/remotecontrolfw/common/remconserver.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/common/remconserver.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -33,9 +33,10 @@
 _LIT(KRemConServerName, "!RemConSrv");
 
 /** Version numbers for the RemCon server. */
-const TInt8 KRemConSrvMajorVersionNumber = 1;
-const TInt8 KRemConSrvMinorVersionNumber = 1;
-const TInt16 KRemConSrvBuildNumber = 0;
+const TInt8 KRemConSrvMajorVersionNumber = 2;
+const TInt8 KRemConSrvMinorVersionNumber = 0;
+const TInt16 KRemConSrvControllerSession = 1;
+const TInt16 KRemConSrvTargetSession = 2;
 
 /** IPC messages supported by the RemCon server. */
 enum TRemConIpc
@@ -44,7 +45,7 @@
 	ERemConDbgCheckHeap 					= 1,
 	ERemConDbgMarkEnd						= 2,
 	ERemConDbgFailNext						= 3,
-	ERemConSetClientType					= 4,
+	ERemConSetPlayerType					= 4,
 	ERemConGoConnectionOriented 			= 5,
 	ERemConGoConnectionless 				= 6,
 	ERemConConnectBearer					= 7,
--- a/accessoryservices/remotecontrolfw/server/group/remconserver.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/group/remconserver.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -51,6 +51,9 @@
 SOURCE			bulksession.cpp
 SOURCE			bulkmain.cpp
 SOURCE			bulkbearerinterface.cpp
+SOURCE			controllersession.cpp 
+SOURCE			targetsession.cpp
+SOURCE			targetclientprocess.cpp
 
 SOURCEPATH		../../common
 SOURCE			utils.cpp
--- a/accessoryservices/remotecontrolfw/server/inc/activehelper.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/inc/activehelper.h	Mon Oct 04 02:28:24 2010 +0300
@@ -24,7 +24,7 @@
 #include <e32def.h>
 #include <e32base.h>
 
-class CRemConSession;
+class CRemConControllerSession;
 
 /**
 Active Helper.
@@ -33,7 +33,7 @@
 NONSHARABLE_CLASS(CActiveHelper) : public CActive
 	{
 public:
-	CActiveHelper(CRemConSession &aSession);
+	CActiveHelper(CRemConControllerSession &aSession);
 	~CActiveHelper();
 	void Complete();
 private:
@@ -41,7 +41,7 @@
 	void RunL();
 	void DoCancel();
 private:
-	CRemConSession& iSession;
+	CRemConControllerSession& iSession;
 	};
 
 
--- a/accessoryservices/remotecontrolfw/server/inc/bearermanager.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/inc/bearermanager.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -72,14 +72,13 @@
 	immediately. */
 	TInt Send(CRemConMessage& aMsg);
 	
-	/** called by the server when a client has set its type (controller/target)
-	calls back to server to see whether it needs to inform each bearer in turn */
-	void ClientTypeSet(TBool aController);
-	
 	/** called by the server when a target client has registered its available
 	interfaces and is ready to be used by a remote. */
 	void TargetClientAvailable(TRemConClientId aId, const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName);
 	
+	/** called by the server when a target client has updated its available interfaces*/
+	void TargetFeaturesUpdated(TRemConClientId aId, const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName);
+	
 	/** Called by the server when a controller client has registered its 
 	available interfaces.  
 	*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/inc/controllersession.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,154 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef CONTROLLERSESSION_H
+#define CONTROLLERSESSION_H
+
+#include "session.h"
+#include "messagesendobserver.h"
+
+class CActiveHelper;
+NONSHARABLE_CLASS(CRemConControllerSession) : public CRemConSession, public MRemConMessageSendObserver
+	{
+public:
+	/**
+	Factory method.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aClientInfo Information about the client using this session.
+	@param aId The unique ID of the new session.
+	@return Ownership of a new session.
+	*/
+	static CRemConControllerSession* NewL(CRemConServer& aServer,
+		CBearerManager& aBearerManager,
+		const TClientInfo& aClientInfo,
+		TUint aId);
+
+	~CRemConControllerSession();
+
+	/** 
+	Checks if this message is supported by the session
+	@param aMsg The message to check
+	@return ETrue if it is, EFalse otherwise
+	*/
+	TBool SupportedMessage(const CRemConMessage& aMsg) const;
+
+	inline const TPlayerType& PlayerType() const;
+	inline const TPlayerSubType& PlayerSubType() const;
+	inline const TDesC8& Name() const;
+	
+public: // called by the bearer manager
+	/**
+	Indicates that a connect request has been completed. The request was not 
+	necessarily from this session- the session must check that the connected 
+	address is one it has asked to be connected. If it is, and we have a 
+	connect request outstanding, the connect request should be completed.
+	@param aAddr The connected address.
+	@param aError The error with which the connection attempt was completed.
+	*/
+	void CompleteConnect(const TRemConAddress& aAddr, TInt aError);
+
+	/**
+	Indicates that a disconnect request has been completed. The request was 
+	not necessarily from this session- the session must check that the 
+	disconnected address is one it has asked to be disconnected. If it is, and 
+	we have a disconnect request outstanding, the disconnect request should be 
+	completed.
+	@param aAddr The disconnected address.
+	@param aError The error with which the disconnection attempt was 
+	completed.
+	*/
+	void CompleteDisconnect(const TRemConAddress& aAddr, TInt aError);
+	
+public: // called by the active helper
+	void ProcessPendingMsgL();
+	
+private:
+	/**
+	Constructor.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aId The unique ID of the new session.
+	*/
+	CRemConControllerSession(CRemConServer& aServer, 
+		CBearerManager& aBearerManager,
+		TUint aId);
+
+	/**
+	2nd-phase construction.
+	@param aClientInfo Information about the client using this session.
+	*/
+	void ConstructL(const TClientInfo& aClientInfo);
+	
+private: // From CRemConSession: utility- IPC command handlers
+	void SetPlayerType(const RMessage2& aMessage);
+	void SendUnreliable(const RMessage2& aMessage);
+	void RegisterInterestedAPIs(const RMessage2& aMessage);
+	void GoConnectionOriented(const RMessage2& aMessage);
+	void GoConnectionless(const RMessage2& aMessage);
+	void ConnectBearer(const RMessage2& aMessage);
+	void ConnectBearerCancel(const RMessage2& aMessage);
+	void DisconnectBearer(const RMessage2& aMessage);
+	void DisconnectBearerCancel(const RMessage2& aMessage);
+	void SendNotify(const RMessage2& aMessage);
+
+private: // From CRemConSession: utility
+	CRemConMessage* DoPrepareSendMessageL(const RMessage2& aMessage);
+	void DoSendCancel();
+	void DoReceive();
+	
+private: // utility
+	CRemConMessage* DoCreateUnreliableMessageL(const RMessage2& aMessage);
+	void DoSendNotifyL(const RMessage2& aMessage);
+	
+	void SendToServer(CRemConMessage& aMsg);
+	
+	void CheckForPendingMsg() const; 
+	void EmptySendQueue();
+
+	void CompleteMessage(const CRemConMessage& aMessage);
+
+public: //From MRemConMessageSendObserver
+	void MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes);
+	void MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes);	// Not supported
+	void MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage);	// Not supported
+
+private: // message handles for asynchronous IPC requests
+	// Address of remote device associated with this session.
+	// A null remote address indicates a connectionless 
+	// controller; a non-null UID indicates a connection-oriented controller.
+	TRemConAddress iRemoteAddress;
+
+	RMessage2 iConnectBearerMsg;
+	RMessage2 iDisconnectBearerMsg;
+	// Stores pending connect/disconnect request
+	// There can be only one pending request at any time
+	RMessage2 iPendingMsg;
+	
+	// Helps with session's async connect/disconnect requests
+	CActiveHelper *iPendingMsgProcessor;
+
+	// the player type information
+	TPlayerTypeInformation iPlayerType;
+	//the player name 
+	RBuf8 iPlayerName;
+	};
+
+#include "controllersession.inl"
+
+#endif /* CONTROLLERSESSION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/inc/controllersession.inl	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+inline const TPlayerType& CRemConControllerSession::PlayerType() const
+	{
+	return iPlayerType.iPlayerType;
+	}
+
+inline const TPlayerSubType& CRemConControllerSession::PlayerSubType() const
+	{
+	return iPlayerType.iPlayerSubType;
+	}
+
+inline const TDesC8& CRemConControllerSession::Name() const
+	{
+	return iPlayerName;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/inc/messagesendobserver.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,102 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// server-side sessions open
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MESSAGESENDOBSERVER_H
+#define MESSAGESENDOBSERVER_H
+
+class MRemConMessageSendObserver
+	{
+public:
+
+	/**
+	Called by CRemConServer to provide the result of an attempt to send a given message to a single remote.
+	This should be used in cases where a command can only be delivered to zero or one remotes (e.g. a notify command)
+	AND the observer does not require notification in advance of the number of remotes.
+	The observer should complete its client request with the error given here.
+	@param aMessage The CRemConMessage whose send was attempted.
+	@param aError The result of the send attempt (KErrNone in success).
+	*/
+	virtual void MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError)=0;
+
+	/**
+	Called by CRemConServer to notify the observer that an attempt is about to be made to send a particular message
+	to one or more remotes.
+	This allows CRemConServer to notify the session in advance of the number of remotes to which the send will be attempted.
+	If the number of remotes is 1, this method can still be used to provide the session with notification of the number of remotes.
+	MrcmsoMessageSendOneOrMoreResult() will be invoked for each remote to which an attempt is made to send the message.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	@param aMessage The CRemConMessage whose send is about to be attempted.
+	@param aNumRemotes The number of remotes that the message is to be sent to.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes)=0;
+
+	/**
+	Called by CRemConServer to notify the observer that an attempt is about to be made to send a particular message to n 
+	further remotes.
+	This can be used when the exact number of remotes is not known at first. This should not be invoked after the first
+	attempt to send the message has been made.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	@param aMessage The CRemConMessage whose send is about to be attempted.
+	@param aNumRemotes The number of additional remotes that this message is to be sent to.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes)=0;
+
+	/**
+	Called by CRemConServer to indicate that a message send attempt to one or more remotes could not be made.
+	For example, the send attempt may have failed because as the message could not be addressed.
+	The observer should complete its client	request immediately with the given error.
+	@param aMessage The CRemConMessage whose send was attempted.
+	@param aError An error preventing the attempt from being made.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError)=0;
+
+	/**
+	Called by CRemConServer to provide the result of an attempt to send a given message to one of a number of remotes.
+	A call is made to this method for each remote for which an attempted send was made.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	If the message send result is unexpected (i.e. the observer believes that no remotes should have been tried), then the observer
+	may ignore this result. For example, the observers client may have cancelled its send request for this message.
+	@param aMessage The CRemConMessage whose send was attempted.
+	@param aError The result of the send attempt (KErrNone in success).
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError)=0;
+
+	/**
+	Called by CRemConServer to indicate that the sending of a given message to a remote was abandoned.
+	This provides a mechanism whereby CRemConServer may drop a message without sending an error back
+	to the client. For example, if the message is not permitted by the TSP for the remote, or fails to match a
+	command, then the attempt for this remote should be abandoned but the client may still be completed
+	without error. If a message cannot be sent because of an error, then MrcmsoMessageSendResult() should be used.
+	The observer should keep track of the number of remotes to which the message is still to be sent and should complete its client
+	request once all remotes have been tried.
+	If the message send result is unexpected (i.e. the observer believes that no remotes should have been tried), then the observer
+	may ignore this result. For example, the observers client may have cancelled its send request for this message.
+	@param aMessage The CRemConMessage whose send was attempted.
+	*/
+	virtual void MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage)=0;
+
+	};
+
+#endif // MESSAGESENDOBSERVER_H
--- a/accessoryservices/remotecontrolfw/server/inc/server.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/inc/server.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -34,7 +34,10 @@
 class REComSession;
 class CBearerManager;	
 class CConverterManager;
+class CRemConTargetClientProcess;
 class CRemConSession;
+class CRemConTargetSession;
+class CRemConControllerSession;
 class CMessageQueue;
 class CRemConTargetSelectorPlugin;
 class CRemConMessage;
@@ -66,51 +69,120 @@
 	*/
 	static CRemConServer* NewLC();
 
-	/** Destructor. */
 	~CRemConServer();
 
-public: // called by session objects 
-	/** Called by a session when a client session is created. Cancels the 
-	shutdown timer in accordance with transient server design. */
-	TInt ClientOpened(CRemConSession& aSession);
+public: // called by controller session objects 
 
-	/** Called by a session when it has had its client type set (i.e. becomes 
-	a controller or a target). Uses the bearer manager to inform bearers as appropriate.
-	*/
-	void ClientTypeSet(CRemConSession& aSession);
-	
-	/** Called by a target session when it has had its features registered. */
-	void TargetClientAvailable(CRemConSession& aSession);
-	
+	/** Called by a controller session when created. Cancels the 
+	shutdown timer in accordance with transient server design. */
+	TInt ControllerClientOpened(CRemConControllerSession& aSession);
+		
 	/** Called by a controller session when it has had its features registered. */
 	void ControllerClientAvailable();
 
-	/** Called by a session when it has had its client goes connection oriented
+	/** Called by a controller session when it has had its client go connection oriented
 	Uses the bearer manager to inform bearers as appropriate
 	aUid is the uid of the bearer we are going connection oriented on.
 	*/
-	void ClientGoConnectionOriented(CRemConSession& aSession, TUid aUid);
+	void ClientGoConnectionOriented(CRemConControllerSession& aSession, TUid aUid);
 	
-	/** Called by a session when it has had its client go connection less.
+	/** Called by a controller session when it has had its client go connection less.
 	 Uses the bearer manager to inform bearers as appropriate.
 	 aUid is the uid of the bearer we were connection oriented on,
 	*/
-	void ClientGoConnectionless(CRemConSession& aSession, TUid aUid);
+	void ClientGoConnectionless(CRemConControllerSession& aSession, TUid aUid);
 
-	/** Called by a session when a client session is destroyed. Starts the 
+	/** Called by a controller session it is destroyed. Starts the 
 	shutdown timer if necessary in accordance with transient server design. 
 	Does not assume that the session successfully registered itself with the 
 	server to begin with.
 	aUid is the bearer uid the session was on for connection oriented sessions,
 	if KNullUid the session was connectionless, 
 	*/
-	void ClientClosed(CRemConSession& aSession, TUid aUid);
+	void ControllerClientClosed(CRemConControllerSession& aSession, TUid aUid);
+
+	/**
+	Sends a command.
+	Puts the command on the 'pending TSP' queue so the TSP can either address 
+	it or give it permission to send.
+	Always takes ownership of aMsg. 
+	*/
+	void SendCommand(CRemConMessage& aMsg);
+
+	/**
+	Removes any current message from this controller session from the 'outgoing pending 
+	TSP' queue. If the message is that currently being dealt with by the TSP, 
+	then cancels the TSP's operation.
+	*/
+	void SendCancel(CRemConControllerSession& aSess);
 
 	/**
-	@return ETrue if there's already a session of target type with process ID 
-	aProcId, EFalse otherwise.
+	Tries to complete a Receive request for a controller session.
+	Called by controller sessions when a Receive request is posted. The 'incoming pending 
+	delivery' queue is checked for commands waiting to be delivered to 
+	aSession. The controller session's request is completed with the first such found.
+	*/
+	void ReceiveRequest(CRemConControllerSession& aSession);
+	
+public:	// Called by target client objects (either CRemConTargetClientProcess or CRemConTargetSession)
+
+	/** 
+	Called by CRemConTargetClientProcess to cancel the servers shutdown timer when a new
+	target session has been opened.
+	*/
+	void CancelShutdownTimer();
+
+	/** Called by CRemConTargetClientProcess to notify the server that it is available.
+	This is done when the client has registered one or more interfaces. */
+	void TargetClientAvailable(const CRemConTargetClientProcess& aClient);
+
+	/** Called by CRemConTargetClientProcess to notify the server that it has registered
+	additional intefaces. */
+	void TargetFeaturesUpdated(CRemConTargetClientProcess& aClient);
+
+	/** Called by CRemConTargetClientProcess to notify the server that a target session
+	has closed. */
+	void TargetSessionClosed(CRemConTargetClientProcess& aClient, CRemConTargetSession& aSession);
+
+	/** Called by CRemConTargetClientProcess to notify the server that a client session is closing.
+	Starts the shutdown timer if necessary in accordance with transient server design. 
+	Does not assume that the session successfully registered itself with the 
+	server to begin with.
 	*/
-	TBool TargetClientWithSameProcessId(TProcessId aProcId) const;
+	void TargetClientClosed(CRemConTargetClientProcess& aClient);
+
+	/** Called by a client instance when a session is created. Makes an item 
+	for the session in the record of which points in the connection history 
+	sessions are interested in. */
+	TInt RegisterTargetSessionPointerToConnHistory(const CRemConTargetSession& aSession);
+
+	/**
+	Starts the process of sending a response, via the TSP
+	Completes the client's send message with a bearer-level error.
+	Always takes ownership of aMsg. 
+	*/
+	void SendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
+
+	/** Finishes the process of sending a response, after the TSP
+	has permitted the response
+	Always takes onwership of aMsg.
+	*/
+	void CompleteSendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
+
+	/**
+	Sends a reject back to the bearer.
+	*/
+	void SendReject (TRemConAddress aAddr, TUid aInterfaceUid, TUint aOperationId, TUint aTransactionId);
+
+	/**
+	Tries to complete a Receive request for a target client.
+	Called by clients when a Receive request is posted. The 'incoming pending 
+	delivery' queue is checked for commands waiting to be delivered to 
+	the client. A delivery attempt is made for each pending message.
+	*/
+	void ReceiveRequest(CRemConTargetClientProcess& aClient);
+
+public:	// called by controller and target sessions
 
 	/** Returns the current bearer-level connection state of the system. */
 	CConnections& Connections();
@@ -131,47 +203,6 @@
 	TBool ConnectionHistoryPointerAtLatest(TUint aSessionId) const;
 
 	/**
-	Sends a command.
-	Puts the command on the 'pending TSP' queue so the TSP can either address 
-	it or give it permission to send.
-	Always takes ownership of aMsg. 
-	*/
-	void SendCommand(CRemConMessage& aMsg);
-
-	/**
-	Starts the process of sending a response, via the TSP
-	Completes the client's send message with a bearer-level error.
-	Always takes ownership of aMsg. 
-	*/
-	void SendResponse(CRemConMessage& aMsg, CRemConSession& aSess);
-
-	/** Finishes the process of sending a response, after the TSP
-	has permitted the response
-	Always takes onwership of aMsg.
-	*/
-	void CompleteSendResponse(CRemConMessage& aMsg, CRemConSession& aSess);
-	
-	/**
-	Sends a reject back to the bearer.
-	*/
-	void SendReject (TRemConAddress aAddr, TUid aInterfaceUid, TUint aOperationId, TUint aTransactionId);
-		
-	/**
-	Removes any current message from this session from the 'outgoing pending 
-	TSP' queue. If the message is that currently being dealt with by the TSP, 
-	then cancels the TSP's operation.
-	*/
-	void SendCancel(CRemConSession& aSess);
-
-	/**
-	Tries to complete a Receive request.
-	Called by sessions when a Receive request is posted. The 'incoming pending 
-	delivery' queue is checked for commands waiting to be delivered to 
-	aSession. The session's request is completed with the first such found.
-	*/
-	void ReceiveRequest(CRemConSession& aSession);
-
-	/**
 	Determines a state of a connection to the given remote address.
 	@param - aAddr, remote address of a connection
 	@return - connection state 
@@ -182,10 +213,9 @@
 	Informs RemCon server that one of the interfaces being used by the calling
 	session requires the use of the bulk server.
 	*/
-	TInt BulkServerRequired();
+	TInt BulkServerRequired();	
 	
 public: // called by the bearer manager 
-	inline RPointerArray<CRemConSession>& Sessions();
 
 	/** This function is called when a ConnectIndicate is handled by the 
 	bearer manager (in which case aError will be KErrNone) and when 
@@ -199,7 +229,7 @@
 
 	/** This function is called when a connection goes away, either by 
 	indication (from the remote end) or confirmation (from our end). */
-	void RemoveConnection(const TRemConAddress& aAddr);
+	void RemoveConnection(const TRemConAddress& aAddr, TInt aError);
 
 	/** 
 	Handles a new incoming response. 
@@ -295,19 +325,32 @@
 	TInt MrctspoSetLocalAddressedClient(const TUid& aBearerUid, const TClientInfo& aClientInfo);
 
 private: // utility
+	CRemConControllerSession* CreateControllerSessionL(const RMessage2& aMessage);
+	CRemConTargetSession* CreateTargetSessionL(const RMessage2& aMessage);
+
+	/** Extracts a client's process ID and secure ID from a given RMessage2 and stores
+	in a given TClientInfo. */
+	void ClientProcessAndSecureIdL(TClientInfo& aClientInfo, const RMessage2& aMessage) const;
+
+	void RemoveSessionFromConnHistory(const CRemConSession& aSession);
+
 	/** Removes connection history records which are no longer interesting and 
 	updates the indices in iSession2ConnHistory accordingly. */
 	void UpdateConnectionHistoryAndPointers();
 
-	CRemConSession* Session(TUint aSessionId) const;
+	CRemConControllerSession* ControllerSession(TUint aSessionId) const;
+	CRemConTargetClientProcess* TargetClient(TUint aClientId) const;
+	CRemConTargetClientProcess* TargetClient(TProcessId aProcessId) const;
 	
-	void StartShutdownTimerIfNoSessionsOrBulkThread();
+	void StartShutdownTimerIfNoClientsOrBulkThread();
+	void TryToDropClientProcess(TUint aClientIndex);
 	void LoadTspL();
 	
 	TBool FindDuplicateNotify(CRemConMessage& aMsg);
 	
 #ifdef __FLOG_ACTIVE
-	void LogSessions() const;
+	void LogControllerSessions() const;
+	void LogTargetSessions() const;
 	void LogRemotes() const;
 	void LogConnectionHistoryAndInterest() const;
 	void LogOutgoingCmdPendingTsp() const;
@@ -360,20 +403,32 @@
 	putting it on the correct queue. 
 	Does not take ownership of aMsg.
 	*/
-	void DeliverCmdToClientL(const CRemConMessage& aMsg, CRemConSession& aSess);
+	void DeliverCmdToClientL(const CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
 
 	/** 
-	Utility for delivering a single message to a client session.
+	Utility for delivering a single message to a controller client session.
 	If the session aSess has an outstanding Receive request, completes the 
-	request with aMsg and (if aMsg is a command) puts aMsg the 'incoming 
-	delivered' queue. Otherwise, puts aMsg in the 'incoming pending delivery' 
+	request with aMsg. Otherwise, puts aMsg in the 'incoming pending delivery' 
 	queue. 
 	Always takes ownership of aMsg.
 	@return KErrNone if the message was successfully delivered or put on the
 	incoming pending delivered queue, otherwise one of the system wide error codes
 	Ownership of aMsg will be taken regardless of the error.
 	*/
-	TInt DeliverMessageToClient(CRemConMessage& aMsg, CRemConSession& aSess);
+	TInt DeliverMessageToClient(CRemConMessage& aMsg, CRemConControllerSession& aSess);
+
+	/** 
+	Utility for delivering a single message to a target client.
+	If the client aClient has an outstanding Receive request, completes the 
+	request with aMsg and puts aMsg the 'incoming delivered' queue (since it
+	shall be a command). Otherwise, puts aMsg in the 'incoming pending delivery' 
+	queue. 
+	Always takes ownership of aMsg.
+	@return KErrNone if the message was successfully delivered or put on the
+	incoming pending delivered queue, otherwise one of the system wide error codes
+	Ownership of aMsg will be taken regardless of the error.
+	*/
+	TInt DeliverMessageToClient(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient);
 
 	/** Gives the head outgoing command to the TSP for (a) addressing to 
 	remote target(s), if its address is null, or (b) permission to send, if it 
@@ -398,9 +453,7 @@
 	/** Gives the head outgoing response to the TSP for permission to send */
 	void PermitOutgoingResponse();
 	
-	CRemConSession* TargetSession(TProcessId aProcessId) const;
-	
-	TClientInfo* ClientIdToClientInfo(TRemConClientId aId);
+	TClientInfo* TargetClientIdToClientInfo(TRemConClientId aId);
 	
 	void InitialiseBulkServerThreadL();
 
@@ -431,11 +484,13 @@
 	CBearerManager* iBearerManager;
 	CConverterManager* iConverterManager;
 
-	// Unique identifier seed for sessions.
-	TUint iSessionId;
+	// Unique identifier seed for sessions and clients.
+	// Controller sessions, target clients and target sessions all need a unique ID.
+	TUint iSessionOrClientId;
 
-	RPointerArray<CRemConSession> iSessions;
-	mutable RNestableLock iSessionsLock;
+	RPointerArray<CRemConControllerSession> iControllerSessions;
+	RPointerArray<CRemConTargetClientProcess> iTargetClients;
+	mutable RNestableLock iTargetClientsLock; 
 
 	// In the following discussion, mark carefully the difference between a 
 	// QUEUE of items awaiting serialised access to a resource, and a LOG of 
@@ -574,11 +629,6 @@
 
 // Inlines
 
-RPointerArray<CRemConSession>& CRemConServer::Sessions()
-	{
-	return iSessions;
-	}
-
 NONSHARABLE_CLASS(CBulkThreadWatcher)
 	: public CActive
 	{
--- a/accessoryservices/remotecontrolfw/server/inc/session.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/inc/session.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -26,13 +26,13 @@
 #include <remconaddress.h>
 #include <remcon/clientinfo.h>
 #include <remcon/clienttype.h>
+#include <remcon/messagetype.h>
 #include <remcon/playertype.h>
 #include <remcon/clientid.h>
 
 class CRemConServer;
 class CBearerManager;
 class CRemConMessage;
-class CActiveHelper;
 class CMessageQueue;
 class CRemConInterfaceDetailsArray;
 class CRemConInterfaceDetails;
@@ -43,20 +43,6 @@
 NONSHARABLE_CLASS(CRemConSession) : public CSession2
 	{
 public:
-	/**
-	Factory method.
-	@param aServer The server.
-	@param aBearerManager The bearer manager.
-	@param aMessage Handle on the client message triggering this session creation.
-	@param aId The unique ID of the new session.
-	@return Ownership of a new session.
-	*/
-	static CRemConSession* NewL(CRemConServer& aServer,
-		CBearerManager& aBearerManager,
-		const RMessage2& aMessage,
-		TUint aId);
-
-	/** Destructor. */
 	~CRemConSession();
 
 public: // called by the server
@@ -87,11 +73,6 @@
 	inline const TClientInfo& ClientInfo() const;
 
 	/**
-	@return This session's type.
-	*/
-	inline TRemConClientType Type() const;
-
-	/**
 	@return This session's unique identifier.
 	*/
 	inline TUint Id() const;
@@ -111,7 +92,7 @@
 	Checks if this message is supported by the session
 	@return ETrue if it is, EFalse otherwise
 	*/
-	TBool SupportedMessage(const CRemConMessage& aMsg);
+	virtual TBool SupportedMessage(const CRemConMessage& aMsg) const = 0;
 
 	/**
 	Writes aMsg to the client's Receive message (NB RMessage2::Write may fail) 
@@ -132,43 +113,24 @@
 	@return Handle to client's receive message.
 	*/
 	inline const RMessage2& CurrentReceiveMessage() const;
-
-	inline const TPlayerType& PlayerType() const;
-	inline const TPlayerSubType& PlayerSubType() const;
-	
-	inline const TDesC8& Name() const;
 	
 	TInt SupportedInterfaces(RArray<TUid>& aUids);
+	TInt AppendSupportedInterfaces(RArray<TUid>& aUids);
 	TInt SupportedBulkInterfaces(RArray<TUid>& aUids);
+	TInt AppendSupportedBulkInterfaces(RArray<TUid>& aUids);
 	TInt SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations);
 
 	/**
 	Panics the client's current Send message with the given code.
 	*/
 	void PanicSend(TRemConClientPanic aCode);
-
-public: // called by the bearer manager
+	
 	/**
-	Indicates that a connect request has been completed. The request was not 
-	necessarily from this session- the session must check that the connected 
-	address is one it has asked to be connected. If it is, and we have a 
-	connect request outstanding, the connect request should be completed.
-	@param aAddr The connected address.
-	@param aError The error with which the connection attempt was completed.
+	Checks whether this session is fully initialised and available for use
+	by bearers.
+	@return ETrue if session can be used by bearers, EFalse otherwise
 	*/
-	void CompleteConnect(const TRemConAddress& aAddr, TInt aError);
-
-	/**
-	Indicates that a disconnect request has been completed. The request was 
-	not necessarily from this session- the session must check that the 
-	disconnected address is one it has asked to be disconnected. If it is, and 
-	we have a disconnect request outstanding, the disconnect request should be 
-	completed.
-	@param aAddr The disconnected address.
-	@param aError The error with which the disconnection attempt was 
-	completed.
-	*/
-	void CompleteDisconnect(const TRemConAddress& aAddr, TInt aError);
+	inline TBool ClientAvailable() const;
 
 	/**
 	Indicates that a connection has come up or down. If the session has a 
@@ -179,57 +141,26 @@
 	*/
 	void ConnectionsChanged();
 	
-public: // called by the active helper
-	/**
-	Process pending messages.
-	*/
-	void ProcessPendingMsgL();
-	
-private:
-	/**
-	Constructor.
-	@param aServer The server.
-	@param aBearerManager The bearer manager.
-	@param aId The unique ID of the new session.
-	*/
-	CRemConSession(CRemConServer& aServer, 
-		CBearerManager& aBearerManager,
-		TUint aId);
+protected:
+    /**
+    Constructor.
+    @param aServer The server.
+    @param aBearerManager The bearer manager.
+    @param aId The unique ID of the new session.
+    */
+    CRemConSession(CRemConServer& aServer, 
+        CBearerManager& aBearerManager,
+        TUint aId);
+    
+    /**
+    2nd-phase construction.
+    @param aMessage The message received from the client.
+    */
+    void BaseConstructL(const TClientInfo& aClientInfo);
 
-	/**
-	2nd-phase construction.
-	@param aMessage The message received from the client.
-	*/
-	void ConstructL(const RMessage2& aMessage);
-		
-private: // from CSession2
-	/**
-	Called when a message is received from the client.
-	@param aMessage Message received from the client.
-	*/
-	void ServiceL(const RMessage2& aMessage);
+	
+protected: 		
 
-private: // utility- IPC command handlers
-	void SetClientType(const RMessage2& aMessage);
-	void GoConnectionOriented(const RMessage2& aMessage);
-	void GoConnectionless(const RMessage2& aMessage);
-	void ConnectBearer(const RMessage2& aMessage);
-	void ConnectBearerCancel(const RMessage2& aMessage);
-	void DisconnectBearer(const RMessage2& aMessage);
-	void DisconnectBearerCancel(const RMessage2& aMessage);
-	void Send(const RMessage2& aMessage);
-	void SendNotify(const RMessage2& aMessage);
-	void SendUnreliable(const RMessage2& aMessage);
-	void SendCancel(const RMessage2& aMessage);
-	void Receive(const RMessage2& aMessage);
-	void ReceiveCancel(const RMessage2& aMessage);
-	void GetConnectionCount(const RMessage2& aMessage);
-	void GetConnections(const RMessage2& aMessage);
-	void NotifyConnectionsChange(const RMessage2& aMessage);
-	void NotifyConnectionsChangeCancel(const RMessage2& aMessage);
-	void RegisterInterestedAPIs(const RMessage2& aMessage);
-	
-private: // utility
 	/**
 	Utility to complete the given message with the given error code.
 	@param aMessage Message to complete.
@@ -237,51 +168,90 @@
 	*/
 	void CompleteClient(const RMessage2& aMessage, TInt aError);
 
-	void DoSendL(const RMessage2& aMessage);
-	void DoSendNotifyL(const RMessage2& aMessage);
-	CRemConMessage* DoCreateUnreliableMessageL(const RMessage2& aMessage);
-	void DoRegisterInterestedAPIsL(const RMessage2& aMessage);
-	void DoSetClientTypeL(const RMessage2& aMessage);
-	void DoSendCancel();
+	CRemConInterfaceDetailsArray* ExtractInterestedAPIsL(const RMessage2& aMessage);
+	
+	/**
+	Gets the information needed to send from the RMessage.
 	
-	CRemConInterfaceDetails* FindInterfaceByUid(TUid aUid) const;
-
-	void SendToServer(CRemConMessage& aMsg);
+	@param aMessage The message containing the info.
+	@param aInterfaceUid The uid of the interface to send on
+	@param aOperationId The operation id to send
+	@param aMessageSubType The sub type of hte message
+	@param aSendDes The operation data to send.  Ownership is passed
+					to the caller and aSendDes is placed on the cleanup
+					stack when this function completes successfully.
+	@leave If the data was not successfully read. Note: if the message is invalid
+	       this function will not leave, but rather panic the message and return
+	       EFalse. This function will only leave if there's a system error, such
+	       as out of memory.
+	@return ETrue if the message information was successfully retrieved,
+			or EFalse if the message is invalid, in which case it got panicked.
+			If this function returns EFalse, aSendDes is not left on the cleanup stack.
+	 */
+	TBool DoGetSendInfoLC(const RMessage2& aMessage, 
+			TUid& aInterfaceUid,
+			TUint& aOperationId,
+			TRemConMessageSubType& aMessageSubType,
+			RBuf8& aSendDes);
+			
+	
+protected: // from CSession2
+	/**
+	Called when a message is received from the client.
+	
+	Also used from the session, where a session has stored
+	a message for later	processing.
 	
-	void CheckForPendingMsg() const; 
+	@param aMessage Message received from the client.
+	*/
+	void ServiceL(const RMessage2& aMessage);
 
+private: // utility- IPC command handlers
+	virtual void SetPlayerType(const RMessage2& aMessage)=0;
+	virtual void SendUnreliable(const RMessage2& aMessage) = 0;
+	virtual void SendCancel(const RMessage2& aMessage);
+	virtual void Receive(const RMessage2& aMessage);
+	virtual void ReceiveCancel(const RMessage2& aMessage);
+	virtual void GetConnectionCount(const RMessage2& aMessage);
+	virtual void GetConnections(const RMessage2& aMessage);
+	virtual void NotifyConnectionsChange(const RMessage2& aMessage);
+	virtual void NotifyConnectionsChangeCancel(const RMessage2& aMessage);
+	virtual void RegisterInterestedAPIs(const RMessage2& aMessage) = 0;
+	virtual void GoConnectionOriented(const RMessage2& aMessage);
+	virtual void GoConnectionless(const RMessage2& aMessage);
+	virtual void ConnectBearer(const RMessage2& aMessage);
+	virtual void ConnectBearerCancel(const RMessage2& aMessage);
+	virtual void DisconnectBearer(const RMessage2& aMessage);
+	virtual void DisconnectBearerCancel(const RMessage2& aMessage);
+	virtual void SendNotify(const RMessage2& aMessage);
+	void Send(const RMessage2& aMessage);
+
+private: // utility
+	virtual CRemConMessage* DoPrepareSendMessageL(const RMessage2& aMessage)=0;
+	virtual void DoSendCancel()=0;
+	virtual void DoReceive()=0;
+	void WriteMessageToClientL(const CRemConMessage& aMsg);
+	virtual void SendToServer(CRemConMessage& aMsg)=0;
 	static TInt SendNextCb(TAny* aThis);
+	void DoSendNext();
 
-	void DoSendNext();
+protected:
+	void DoSendL(const RMessage2& aMessage);
+	void GetPlayerTypeAndNameL(const RMessage2& aMessage, TPlayerTypeInformation& aPlayerType, RBuf8& aPlayerName);
+	CRemConInterfaceDetails* FindInterfaceByUid(TUid aUid) const;
 	
-	void EmptySendQueue();
-
-	void WriteMessageToClientL(const CRemConMessage& aMsg);
-	
-private: // unowned
+protected: // unowned
 	CRemConServer& iServer;
 	CBearerManager& iBearerManager;
 
-private: // message handles for asynchronous IPC requests
-	RMessage2 iConnectBearerMsg;
-	RMessage2 iDisconnectBearerMsg;
+protected: // message handles for asynchronous IPC requests
 	RMessage2 iSendMsg;
 	RMessage2 iReceiveMsg;
 	RMessage2 iNotifyConnectionsChangeMsg;
-	// Stores pending connect/disconnect request
-	// There can be only one pending request at any time
-	RMessage2 iPendingMsg;
-	
+
 	CMessageQueue* iSendQueue;
 	
-private: // owned
-	// Address of remote device associated with this session (only relevant 
-	// for controllers). A null remote address indicates a connectionless 
-	// controller; a non-null UID indicates a connection-oriented controller.
-	TRemConAddress iRemoteAddress;
-
-	TRemConClientType iType;
-
+protected: // owned
 	// The client's process ID, secure ID and caps.
 	TClientInfo iClientInfo;
 
@@ -297,9 +267,8 @@
 	// While processing outgoing commands to multiple remotes, 
 	// iNumRemotesToTry is decremented each time we finish trying to address a 
 	// remote. This may be at the connection stage or the actual send stage.
-	// -1 means that the client's send has been completed already. This is 
-	// useful due to the potentially recursive processing of multiple 
-	// connections.
+	// On return to 0, the client is completed with either the result of the send
+	// or KErrCancel.
 	TInt iNumRemotesToTry;
 	// For completion of the current send request. NB A send may be completed 
 	// only after numerous asynchronous stages.
@@ -307,13 +276,6 @@
 	TInt iSendError;
 	
 	CRemConInterfaceDetailsArray* iInterestedAPIs;
-	// the player type information
-	TPlayerTypeInformation iPlayerType;
-	//the player name 
-	RBuf8 iPlayerName;
-
-	// Helps with session's async connect/disconnect requests
-	CActiveHelper *iPendingMsgProcessor;
 	
 	CAsyncCallBack* iSendNextCallBack;
 	
@@ -325,7 +287,6 @@
 		};
 	
 	TRemConSessionSending iSending;
-	
 	};
 
 // Inlines
@@ -355,11 +316,6 @@
 	return iClientInfo;
 	}
 
-TRemConClientType CRemConSession::Type() const
-	{
-	return iType;
-	}
-
 TUint CRemConSession::Id() const
 	{
 	return iId;
@@ -375,19 +331,11 @@
 	return iReceiveMsg;
 	}
 
-const TPlayerType& CRemConSession::PlayerType() const
-	{
-	return iPlayerType.iPlayerType;
-	}
-
-const TPlayerSubType& CRemConSession::PlayerSubType() const
+TBool CRemConSession::ClientAvailable() const
 	{
-	return iPlayerType.iPlayerSubType;
-	}
-
-const TDesC8& CRemConSession::Name() const
-	{
-	return iPlayerName;
+	// Client is available as soon as it has registered the APIs
+	// it is interested in.
+	return iInterestedAPIs ? ETrue : EFalse;
 	}
 
 #endif // REMCONSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/inc/targetclientprocess.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,257 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// sessions associated with it.
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef TARGETCLIENTPROCESS_H
+#define TARGETCLIENTPROCESS_H
+
+#include <e32base.h>
+#include <remcon/clientinfo.h>
+#include <remcon/clientid.h>
+#include <remcon/playertype.h>
+
+#include "messagesendobserver.h"
+
+
+/**
+The maximum number of target sessions permitted for a single client process
+*/
+const TUint KMaxNumberTargetSessions = 2;
+
+class CRemConServer;
+class CBearerManager;
+class CRemConTargetSession;
+class CRemConInterfaceDetails;
+class CRemConMessage;
+
+/**
+Represents a target client process and manages that clients sessions.
+*/
+NONSHARABLE_CLASS(CRemConTargetClientProcess) : public CBase, public MRemConMessageSendObserver
+	{
+public:
+	static CRemConTargetClientProcess* NewLC(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager);
+	~CRemConTargetClientProcess();
+
+	/**
+	Returns the unique client ID for this client.
+	@return The client ID.
+	*/
+	inline TRemConClientId Id() const;
+
+	/**
+	Returns a description of the client represented by this CRemConTargetClientProcess instance.
+	@return A TClientInfo instance describing the client.
+	*/
+	inline TClientInfo& ClientInfo();
+	inline const TClientInfo& ClientInfo() const;
+
+	/**
+	Indicates whether or not this CRemConTargetClientProcess represents a client described by a given TClientInfo instance.
+	@param aClientInfo The TClientInfo instance describing the client.
+	@return ETrue if the client described by aClientInfo is that represented by this CRemConTargetClientProcess instance.
+	*/
+	inline TBool IsClient(const TClientInfo& aClientInfo) const;
+
+	/**
+	Indicates whether or not this client has been registered as available with the server.
+	@return ETrue if this client has been marked as available.
+	*/
+	inline TBool ClientAvailable() const;
+
+	/**
+	Creates a new target session for the client with a given unique session ID.
+	If the client already has KMaxNumberTargetSessions sessions open, then this will leave with KErrOverflow.
+	@param aSessionId The session ID for the new session.
+	*/
+	CRemConTargetSession* NewSessionL(TUint aSessionId);
+
+	/**
+	Called by CRemConTargetSession to provide notification of the opening of a new session.
+	@param aSession The CRemConTargetSession that is opening.
+	@return KErrNone on success, otherwise one of the other system-wide error codes.
+	*/
+	TInt TargetSessionOpened(CRemConTargetSession& aSession);
+
+	/**
+	Called by CRemConTargetSession to provide notificaton of session closure.
+	@param aSession The CRemConTargetSession that is closing.
+	*/
+	void TargetSessionClosed(CRemConTargetSession& aSession);
+
+	/**
+	Returns the number of target sessions currently open on this client.
+	@return The number of open target sessions.
+	*/
+	inline TInt TargetSessionCount() const;
+
+	/**
+	Sets the player information for this client.
+	This information can only be set once for the client.
+	@param aPlayerType The player type.
+	@param aPlayerName The player name.
+	*/
+	void SetPlayerInformationL(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName);
+
+	/**
+	Indicates whether or not player information has been set for this client.
+	@return ETrue if player information has been set.
+	*/
+	inline TBool HasPlayerInformation() const;
+
+	/**
+	Returns the player type set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return The player type.
+	*/
+	inline TPlayerType PlayerType() const;
+
+	/**
+	Returns the player subtype set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return The player subtype.
+	*/
+	inline TPlayerSubType PlayerSubType() const;
+
+	/**
+	Returns the player name set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return The player name.
+	*/
+	inline const TDesC8& Name() const;
+
+	/**
+	Indicates whether or not the given player information matches that set for this client.
+	This is only valid if HasPlayerInformation() returns ETrue.
+	@return ETrue if the player information matches.
+	*/
+	inline TBool PlayerInformationMatches(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName) const;
+
+	/**
+	Called by CRemConTargetSession to provide notification that the session has registered a new interface.
+	@param aSession The CRemConTargetSession that has registered the new interface.
+	*/
+	void InterfacesRegistered();
+
+	/**
+	Determines whether or not an interface of the same type as that given has already been registered
+	in a session owned by this client, other than the given session.
+	@param aSession The target session to exclude from the interface search.
+	@param aInterface The interface type to test for.
+	@return Whether or not a registered interface of this type exists for the client.
+	**/
+	TBool IsInterfaceTypeRegisteredByAnotherSession(CRemConTargetSession& aSession, TUid aInterfaceUid) const;
+	
+	/**
+	Called by CRemConServer when a message has been received for this client.
+	The client will attempt to deliver the message to the appropriate session. If no session
+	supports the message, KErrArgument is returned. Otherwise, if the supporting session is
+	not ready to receive the message, KErrNotReady is returned. Any other error code is returned
+	by the session as it processes the message.
+	@param aMessage The message for this client.
+	@return KErrArgument if no session supports this message, KErrNotReady if the message cannot be handled yet, or an error
+	code returned by the session as it processes the message.
+	*/
+	TInt ReceiveMessage(CRemConMessage& aMessage);
+
+	/**
+	Indicates that a connection has come up or down.
+	This notifies each session held by this client.
+	*/
+	void ConnectionsChanged();
+
+	/**
+	Provides a list of interfaces supported by this client.
+	@param aUids An RArray to hold the UIDs of the supported interfaces.
+	@return KErrNone on success, otherwise one of the system-wide error codes.
+	*/
+	TInt SupportedInterfaces(RArray<TUid>& aUids);
+
+	/**
+	Provides a list of interfaces supported by this client that require the bulk server.
+	@param aUids An RArray to hold the UIDs of the interfaces.
+	@return KErrNone on success, otherwise one of the system-wide error codes.
+	*/
+	TInt SupportedBulkInterfaces(RArray<TUid>& aUids);
+
+	/**
+	Provides a list of operations supported by a particular interface.
+	@param aInterfaceUid The UID of the interface of interest.
+	@param aOperations An RArray to hold the supported operations.
+	@return KErrNone on success, otherwise one of the system-wide error codes.
+	*/
+	TInt SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations);
+
+public:	// From MRenConMessageSendObserver
+	void MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError);	// Not supported
+	void MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes);
+	void MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes);
+	void MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError);
+	void MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage);
+
+private:
+	CRemConTargetClientProcess(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager);
+
+	/**
+	Returns the target session that supports a given RemCon message.
+	Since no two sessions may register the same interface, there is a maximum of one possible session that could support the message.
+	@param aMessage The RemCon message.
+	@return The supporting CRemConTargetSession instance or NULL if no supporting session could be found.
+	*/
+	CRemConTargetSession* FindSessionForMessage(const CRemConMessage& aMessage);
+
+	/**
+	Returns an index to a target session held by this client that supports a particular interface.
+	@param aInterface The UID of the interface of interest.
+	@return If found, the index of the relevent target session. Otherwise, KErrNotFound or one of the other system-wide error codes.
+	*/
+	TInt FindSessionForInterface(TUid aInterface) const;
+
+	/**
+	Utility method to complete a given RemCon message for a particular target session.
+	@param aMessage The RemCon message
+	@param aSession The target session
+	*/
+	void CompleteMessageForSession(const CRemConMessage& aMessage, CRemConTargetSession& aSession);
+
+private:
+	// Client information
+	TClientInfo iClientInfo;
+	TRemConClientId iClientId;
+	TBool iClientAvailable;
+
+	CRemConServer& iServer;
+	CBearerManager& iBearerManager;
+
+	// Player information
+	TPlayerTypeInformation iPlayerType;
+	RBuf8 iPlayerName;
+	TBool iPlayerInfoSet;
+
+	// Target sessions for this client
+	RPointerArray<CRemConTargetSession> iTargetSessions;
+	
+	};
+
+#include "targetclientprocess.inl"
+
+#endif // TARGETCLIENTPROCESS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/inc/targetclientprocess.inl	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,77 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// sessions associated with it.
+// 
+
+/**
+ @file
+ @internalComponent
+*/
+
+
+inline TRemConClientId CRemConTargetClientProcess::Id() const
+	{
+	return iClientId;
+	}
+
+inline TClientInfo& CRemConTargetClientProcess::ClientInfo()
+	{	
+	return iClientInfo;
+	}
+
+inline const TClientInfo& CRemConTargetClientProcess::ClientInfo() const
+	{	
+	return iClientInfo;
+	}
+
+inline TBool CRemConTargetClientProcess::IsClient(const TClientInfo& aClientInfo) const
+	{
+	return (iClientInfo.ProcessId() == aClientInfo.ProcessId() && iClientInfo.SecureId() == aClientInfo.SecureId());
+	}
+
+inline TBool CRemConTargetClientProcess::ClientAvailable() const
+	{
+	return iClientAvailable;
+	}
+
+inline TInt CRemConTargetClientProcess::TargetSessionCount() const
+	{
+	return iTargetSessions.Count();
+	}
+
+inline TBool CRemConTargetClientProcess::HasPlayerInformation() const
+	{
+	return iPlayerInfoSet;
+	}
+
+inline TPlayerType CRemConTargetClientProcess::PlayerType() const
+	{
+	return iPlayerType.iPlayerType;
+	}
+
+inline TPlayerSubType CRemConTargetClientProcess::PlayerSubType() const
+	{
+	return iPlayerType.iPlayerSubType;
+	}
+
+inline const TDesC8& CRemConTargetClientProcess::Name() const
+	{
+	return iPlayerName;
+	}
+
+inline TBool CRemConTargetClientProcess::PlayerInformationMatches(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName) const
+	{
+	return (aPlayerType.iPlayerType == PlayerType() && aPlayerType.iPlayerSubType == PlayerSubType() && aPlayerName == Name());
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/inc/targetsession.h	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,92 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef TARGETSESSION_H
+#define TARGETSESSION_H
+
+#include "targetclientprocess.h"
+#include "session.h"
+
+NONSHARABLE_CLASS(CRemConTargetSession) : public CRemConSession
+	{
+public:
+	/**
+	Factory method.
+	@param aClientProcess The client for which this session is being created.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aId The unique ID of the new session.
+	@return Ownership of a new session.
+	*/
+	static CRemConTargetSession* NewL(CRemConTargetClientProcess& aClientProcess,
+		CRemConServer& aServer,
+		CBearerManager& aBearerManager,
+		TUint aId);
+
+	~CRemConTargetSession();
+
+	/** 
+	From CRemConSession.
+	Checks if this message is supported by the session
+	@param aMsg The message to check
+	@return ETrue if it is, EFalse otherwise
+	*/
+	TBool SupportedMessage(const CRemConMessage& aMsg) const;
+
+	/**
+	 Indicates whether or not a given interface is supported by this
+	 target session.
+	 @param aInterfaceUid The UID of the interface to check for.
+	 @return ETrue if the interface is supported.
+	 */
+	TBool InterfaceSupported(TUid aInterfaceUid) const;
+
+private: // From CRemConSession: utility- IPC command handlers
+	void SetPlayerType(const RMessage2& aMessage);
+	void SendUnreliable(const RMessage2& aMessage);
+	void RegisterInterestedAPIs(const RMessage2& aMessage);
+
+private: // From CRemConSession: utility
+	CRemConMessage* DoPrepareSendMessageL(const RMessage2& aMessage);
+	void DoSendCancel();
+	void DoReceive();
+	void SendToServer(CRemConMessage& aMsg);
+	
+private: // utility
+	CRemConMessage* DoCreateUnreliableMessageL(const RMessage2& aMessage);
+	
+	
+private:
+	/**
+	Constructor.
+	@param aServer The server.
+	@param aBearerManager The bearer manager.
+	@param aId The unique ID of the new session.
+	*/
+	CRemConTargetSession(CRemConTargetClientProcess& aClientProcess,
+		CRemConServer& aServer, 
+		CBearerManager& aBearerManager,
+		TUint aId);
+
+	/**
+	2nd-phase construction.
+	*/
+	void ConstructL();
+
+private:
+	CRemConTargetClientProcess&	iClientProcess;
+	};
+
+#endif /* TARGETSESSION_H */
--- a/accessoryservices/remotecontrolfw/server/public/remconserverpanic.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/public/remconserverpanic.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -144,6 +144,18 @@
 	The client is paniced for misusing this API.
 	*/
 	ERemConClientPanicRegisterInterestedOperationsInNonTargetSession	= 16,
+	
+	/** The client has not had their features set. */
+	ERemConClientPanicClientFeaturesNotSet								= 17,
+
+	/** The client has tried to register the same interface in multiple sessions. */
+	ERemConClientPanicClientInterfaceAlreadyRegistered					= 18,
+
+	/** The client has tried to register different player information in multiple sessions. 
+	 For example, this can happen if an application directly using the RemCon client side interfaces 
+	 also uses another component that itself uses the RemCon client interfaces, such as Qt Key Capture.
+	 */
+	ERemConClientPanicPlayerInfoAlreadySet								= 19,
 	};
 
 #endif // REMCONSERVERPANIC_H
--- a/accessoryservices/remotecontrolfw/server/src/activehelper.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/src/activehelper.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -22,13 +22,13 @@
 
 #include <bluetooth/logger.h>
 #include "activehelper.h"
-#include "session.h"
+#include "controllersession.h"
 
 #ifdef __FLOG_ACTIVE
 _LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
 #endif
 
-CActiveHelper::CActiveHelper(CRemConSession &aSession) : 
+CActiveHelper::CActiveHelper(CRemConControllerSession &aSession) : 
 	CActive(CActive::EPriorityStandard),
 	iSession(aSession)
 	{
--- a/accessoryservices/remotecontrolfw/server/src/bearermanager.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/src/bearermanager.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -457,44 +457,6 @@
 	return ret;
 	}
 
-void CBearerManager::ClientTypeSet(TBool aController)
-	{
-	LOG_FUNC;
-	LOG1(_L("\taController = %x"), aController);
-		
-	/* When a client (session) has its type set (controller or target) then 
-	   it will still have a bearer uid of NullUid. In this case we want to 
-	   update any bearers which now have a controller or target count moving to 1 */
-	const TUint count = iBearerIfs.Count();
-	for ( TUint ii = 0 ; ii < count ; ++ii )
-		{
-		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
-		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
-
-		ASSERT_DEBUG(bearerIf);
-		/* maintain the controller and target count for each bearer 
-		   tell the bearer if the count has increased to 1
-		   by doing this in this loop we are sure we only 
-		   tell the bearer when we need to */
-		if (aController)
-			{
-			iBearerIfs[ii].iControllerCount++;
-			if (1 == iBearerIfs[ii].iControllerCount)
-				{
-				bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
-				}
-			}
-		else
-			{
-			iBearerIfs[ii].iTargetCount++;
-			if (1 == iBearerIfs[ii].iTargetCount)
-				{
-				bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
-				}
-			}
-		}
-	}
-
 void CBearerManager::TargetClientAvailable(TRemConClientId aId, const TPlayerType& aClientType, const TPlayerSubType& aClientSubType, const TDesC8& aName)
 	{
 	LOG_FUNC;
@@ -502,8 +464,19 @@
 	const TUint count = iBearerIfs.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
+		// maintain the controller and target count for each bearer 
+		// tell the bearer if the count has increased to 1
+		// by doing this in this loop we are sure we only 
+		// tell the bearer when we need to */
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		ASSERT_DEBUG(bearerIf);
+		iBearerIfs[ii].iTargetCount++;
+		if (1 == iBearerIfs[ii].iTargetCount)
+			{
+			bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+			}
+		
 		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
-
 		if(bearerIfV3)
 			{
 			bearerIfV3->ClientAvailable(aId, aClientType, aClientSubType, aName);
@@ -511,6 +484,22 @@
 		}
 	}
 
+void CBearerManager::TargetFeaturesUpdated(TRemConClientId aId, const TPlayerType& aPlayerType, const TPlayerSubType& aPlayerSubType, const TDesC8& aName)
+    {
+    LOG_FUNC;
+        
+    const TUint count = iBearerIfs.Count();
+    for ( TUint ii = 0 ; ii < count ; ++ii )
+        {
+        MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
+
+        if(bearerIfV3)
+            {
+            bearerIfV3->TargetFeaturesUpdated(aId, aPlayerType, aPlayerSubType, aName);
+            }
+        }
+    }
+
 void CBearerManager::ControllerClientAvailable()
 	{
 	LOG_FUNC;
@@ -519,11 +508,24 @@
 	TInt err = iServer.ControllerSupportedInterfaces(supportedInterfaces);
 	LOG2(_L("\tGot %d supported interfaces with result %d"), supportedInterfaces.Count(), err);
 	
-	if(!err)
+	const TUint count = iBearerIfs.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		const TUint count = iBearerIfs.Count();
-		for ( TUint ii = 0 ; ii < count ; ++ii )
+		// maintain the controller and target count for each bearer 
+		// tell the bearer if the count has increased to 1
+		// by doing this in this loop we are sure we only 
+		// tell the bearer when we need to
+		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
+		ASSERT_DEBUG(bearerIf);
+		iBearerIfs[ii].iControllerCount++;
+		if (1 == iBearerIfs[ii].iControllerCount)
 			{
+			bearerIf->ClientStatus(TBool(iBearerIfs[ii].iControllerCount), TBool(iBearerIfs[ii].iTargetCount));
+			}
+
+		if(!err)
+			{
+			// If we know what the supported interface are we can tell the bearer
 			MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
 
 			if(bearerIfV3)
@@ -531,9 +533,9 @@
 				bearerIfV3->ControllerFeaturesUpdated(supportedInterfaces);
 				}
 			}
-		
-		supportedInterfaces.Close();
 		}
+	
+	supportedInterfaces.Close();
 	}
 
 void CBearerManager::ClientConnectionOriented(TUid aUid)
@@ -545,12 +547,11 @@
 		{
 		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
 		ASSERT_DEBUG(bearerIf);
-		/* maintain the controller and target count for each bearer 
-		   target count won't change for this
-		   Controller won't change if we are the bearer being targetted by the controller
-		   it will go down if we're not.
-		   Tell the bearer if the controller count has decreased to zero
-		*/
+		// maintain the controller and target count for each bearer 
+		// target count won't change for this
+		// Controller won't change if we are the bearer being targetted by the controller
+		// it will go down if we're not.
+		// Tell the bearer if the controller count has decreased to zero
 		if (aUid != iBearerIfs[ii].iBearerUid)
 			{
 			iBearerIfs[ii].iControllerCount--;
@@ -577,13 +578,12 @@
 		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
 		ASSERT_DEBUG(bearerIf);
 
-		/* maintain the controller and target count for each bearer 
-		   target count won't change for this
-		   Controller won't change if we were the bearer being targetted by the controller
-		   it will go up if we're not.
-		   tell the bearer if the controller count has increased to 1 and provide
-		   it with the current feature list.	   
-		*/
+		// maintain the controller and target count for each bearer 
+		// target count won't change for this
+		// Controller won't change if we were the bearer being targetted by the controller
+		// it will go up if we're not.
+		// tell the bearer if the controller count has increased to 1 and provide
+		// it with the current feature list.	   
 		if (aUid != iBearerIfs[ii].iBearerUid)
 			{
 			iBearerIfs[ii].iControllerCount++;
@@ -621,21 +621,18 @@
 		MRemConBearerInterface* const bearerIf = iBearerIfs[ii].iIf;
 		MRemConBearerInterfaceV3* const bearerIfV3 = iBearerIfs[ii].iIfV3;
 		ASSERT_DEBUG(bearerIf);
-		/* maintain the controller and target count for each bearer 
-		   the target count may change for this
-		   Controller won't change if we were the bearer being targetted by the controller
-		   it will go up if we're not.
-		   
-		*/
+		// maintain the controller and target count for each bearer 
+		// the target count may change for this
+		// Controller won't change if we were the bearer being targetted by the controller
+		// it will go up if we're not.
 		if (aController)
 			{
-			/* so if the aUid is not null then the closed session affects only
-			   the bearer it was pointing at. If the uid is NULL then its affecting
-			   all bearers
-			   tell the bearer if controller or target count has reached zero.
-			   If there are controllers left then let the bearer know the current
-			   feature set.
-			 */
+			// so if the aUid is not null then the closed session affects only
+			// the bearer it was pointing at. If the uid is NULL then its affecting
+			// all bearers
+			// tell the bearer if controller or target count has reached zero.
+			// If there are controllers left then let the bearer know the current
+			// feature set.
 			if ((aUid == iBearerIfs[ii].iBearerUid) || (KNullUid == aUid))
 				{
 				iBearerIfs[ii].iControllerCount--;
@@ -926,7 +923,7 @@
 	LOG_FUNC;
 	
 	// Just call the handler for removed connections.
-	iServer.RemoveConnection(aAddr);
+	iServer.RemoveConnection(aAddr, KErrNone);
 	}
 
 TInt CBearerManager::MrcboDoConnectConfirm(const TRemConAddress& aAddr, TInt aError)
@@ -958,17 +955,7 @@
 	if ( aError == KErrNone )
 		{
 		// Remove connection and complete notifications.
-		iServer.RemoveConnection(aAddr);
-		}
-
-	// Complete the specific request(s) that caused a DisconnectRequest on the 
-	// bearer. Tell all sessions- they remember the address they wanted to 
-	// connect to, and will filter on the address we give them.
-	const TUint count = iServer.Sessions().Count();
-	for ( TUint ii = 0 ; ii < count ; ++ii )
-		{
-		ASSERT_DEBUG(iServer.Sessions()[ii]);
-		iServer.Sessions()[ii]->CompleteDisconnect(aAddr, aError);
+		iServer.RemoveConnection(aAddr, aError);
 		}
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/src/controllersession.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,958 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <bluetooth/logger.h>
+#include "activehelper.h"
+#include "bearermanager.h"
+#include "controllersession.h"
+#include "messagequeue.h"
+#include "remconmessage.h"
+#include "remconserver.h"
+#include "server.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("ctsession");
+#endif
+
+
+CRemConControllerSession* CRemConControllerSession::NewL(CRemConServer& aServer,
+	CBearerManager& aBearerManager,
+	const TClientInfo& aClientInfo,
+	TUint aId)
+	{
+	LOG_STATIC_FUNC;
+	CRemConControllerSession* self = new(ELeave) CRemConControllerSession(aServer, aBearerManager, aId);
+	CleanupStack::PushL(self);
+	self->ConstructL(aClientInfo);
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CRemConControllerSession::~CRemConControllerSession()
+	{
+	LOG_FUNC;
+
+	delete iPendingMsgProcessor;
+
+	// we will need to tell the server which bearer this used to be connected to
+	// this enables the server to not inform a bearer that is already connected
+	// that its been connected
+	// Tell the server we've gone away- it may start its shutdown timer.
+	iServer.ControllerClientClosed(*this, iRemoteAddress.BearerUid());
+	iPlayerName.Close();
+	}
+
+CRemConControllerSession::CRemConControllerSession(CRemConServer& aServer, 
+	CBearerManager& aBearerManager,
+	TUint aId)
+	: CRemConSession(aServer, aBearerManager, aId)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConControllerSession::ConstructL(const TClientInfo& aClientInfo)
+	{
+	LOG_FUNC;
+	
+	BaseConstructL(aClientInfo);
+
+	iPendingMsgProcessor = new (ELeave) CActiveHelper(*this);
+	
+	LEAVEIFERRORL(iServer.ControllerClientOpened(*this));
+
+	// Set our pointer into the connection history at the current/'Last' item.
+	// Can't do this til we've told the server we exist
+	iServer.SetConnectionHistoryPointer(Id());
+	}
+
+TBool CRemConControllerSession::SupportedMessage(const CRemConMessage& aMsg) const
+	{
+	LOG_FUNC;
+	LOG1(_L("\taMsg.InterfaceUid() = 0x%08x"), aMsg.InterfaceUid());
+
+	// Return true unless this is a command for an unsupported interface
+	TBool result = !(aMsg.MsgType() == ERemConCommand && !FindInterfaceByUid(aMsg.InterfaceUid()));
+
+	LOG1(_L("result = %d"), result);
+	return result;
+	}
+
+void CRemConControllerSession::SetPlayerType(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Controller clients don't provide the additional parameters are optional,
+	// so we just complete the message with KErrNone.
+	CompleteClient(aMessage, KErrNone);
+	}
+
+void CRemConControllerSession::CompleteConnect(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+
+	LOG1(_L("\tiRemoteAddress.BearerUid = 0x%08x"), iRemoteAddress.BearerUid());
+	LOG1(_L("\tiConnectBearerMsg.Handle = %d"), iConnectBearerMsg.Handle());
+
+	if ( iRemoteAddress == aAddr )
+		{
+		if ( iConnectBearerMsg.Handle() )
+			{
+			// We are a session that has an outstanding request on this specific 
+			// connection address.
+			CompleteClient(iConnectBearerMsg, aError);
+			}
+		else 
+			{
+			// Connect bearer message is not valid. 
+			// Check for pending messages.
+			CheckForPendingMsg();
+			}
+		}
+	}
+
+void CRemConControllerSession::CompleteDisconnect(const TRemConAddress& aAddr, TInt aError)
+	{
+	LOG_FUNC;
+	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+
+	LOG1(_L("\tiRemoteAddress.BearerUid = 0x%08x"), iRemoteAddress.BearerUid());
+	LOG1(_L("\tiDisconnectBearerMsg.Handle = %d"), iDisconnectBearerMsg.Handle());
+
+	if ( iRemoteAddress == aAddr )
+		{
+		if ( iDisconnectBearerMsg.Handle() )
+			{
+			// We are a session that has an outstanding request on this specific 
+			// connection address.
+			CompleteClient(iDisconnectBearerMsg, aError);
+			}
+		else 
+			{
+			// Diconnect bearer message is not valid. 
+			// Check for pending messages.
+			CheckForPendingMsg();
+			}
+
+		}
+	}
+
+void CRemConControllerSession::ProcessPendingMsgL()
+	{
+	LOG_FUNC;
+	if (!iPendingMsg.Handle())
+		{
+		// This means that the pending connect or disconnect message,
+		// has been cancelled by the time we got here.
+		// (It was cancelled between two following calls:
+		// iPendingMsgProcessor::Complete and iPendingMsgProcessor::RunL
+		return;
+		}
+
+	ServiceL(iPendingMsg);
+	if (iPendingMsg.Handle())
+		{
+		// This means that the pending msg has not been completed in ServiceL call.
+		// It was stored either in iConnectBearerMsg or iDisconnectBearerMsg member.
+		// This also means that this message is not "pending" any more 
+		// (as processing of its copy has been started). 
+		// However because the copy will get completed we need to 
+		// clean iPendingMsg.iHandle here
+		// To supress coverity error for uninitialized use of 'emptyMsg' coverity annotations
+		// are used as the in-line default constructor of RMessage2 doesn't initialize all member variables.
+		// coverity[var_decl]
+		RMessage2 emptyMsg;
+		iPendingMsg = emptyMsg;
+		}
+	}
+
+void CRemConControllerSession::CheckForPendingMsg() const
+	{
+	LOG_FUNC;
+	if (iPendingMsg.Handle())
+		{
+		ASSERT_DEBUG(iPendingMsgProcessor);
+		iPendingMsgProcessor->Complete();
+		}
+	}
+
+CRemConMessage* CRemConControllerSession::DoPrepareSendMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we don't have a disconnect outstanding- this makes no sense from 
+	// a client viewpoint (they should cancel the disconnect first).
+	// [The client is allowed to have a connect request outstanding- the 
+	// bearer manager makes sure a bearer-level connect is not posted on the 
+	// same address twice.]
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return NULL;
+		}
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	if (!DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes))
+		{
+		// DoGetSendInfoLC() panicked the message
+		return NULL;
+		}
+
+	CRemConMessage* msg = NULL;
+	LOG(_L("\tCONTROLLER send"));
+	if (  (messageSubType == ERemConNotifyCommandAwaitingInterim)
+	   || (messageSubType == ERemConNotifyCommandAwaitingChanged)
+		)
+		{
+		LOG(_L("\terror, not allowed to use Send() to send notify command"));
+		CleanupStack::PopAndDestroy(&sendDes);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		}
+	else
+		{
+		msg = CRemConMessage::NewL(
+				iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
+				ERemConCommand, 
+				messageSubType,
+				interfaceUid,
+				operationId,
+				sendDes, // msg takes ownership
+				Id(), // session id for when the response comes back
+				0, // we let the bearer manager invent a new transaction id when the message gets to it
+				ETrue);
+		CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+		}		
+
+	return msg;
+	}
+
+void CRemConControllerSession::SendUnreliable(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// Check we don't have a disconnect outstanding- this makes no sense from 
+	// a client viewpoint (they should cancel the disconnect first).
+	// [The client is allowed to have a connect request outstanding- the 
+	// bearer manager makes sure a bearer-level connect is not posted on the 
+	// same address twice.]
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	CRemConMessage* msg = NULL;
+	TRAPD(err, msg = DoCreateUnreliableMessageL(aMessage));
+	CompleteClient(aMessage, err);
+	if (err == KErrNone)
+		{
+		ASSERT_DEBUG(iSendQueue);
+		if (iSending || !iSendQueue->IsEmpty())
+			{
+			iSendQueue->Append(*msg);
+			}
+		else
+			{
+			SendToServer(*msg);
+			}
+		}
+	}
+
+CRemConMessage* CRemConControllerSession::DoCreateUnreliableMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes);
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	CRemConMessage* msg = NULL;
+	
+	LOG(_L("\tCONTROLLER send"));
+	
+	// A client is not allowed to send an unreliable notify command.
+	if	(	(messageSubType == ERemConNotifyCommandAwaitingInterim)
+		||	(messageSubType == ERemConNotifyCommandAwaitingChanged)
+		)
+		{
+		LOG(_L8("\tNot allowed to send unreliable notify command"));
+		CleanupStack::PopAndDestroy(&sendDes);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		LEAVEL(KErrBadDescriptor);
+		}
+	
+	msg = CRemConMessage::NewL(
+		iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
+		ERemConCommand, // controllers can only send commands
+		messageSubType,
+		interfaceUid,
+		operationId,
+		sendDes, // msg takes ownership
+		Id(), // session id for when the response comes back
+		0, // we let the bearer manager invent a new transaction id when the message gets to it
+		EFalse);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+
+	return msg;
+	}
+
+void CRemConControllerSession::RegisterInterestedAPIs(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	// No interfaces should have been registered yet!
+	ASSERT_DEBUG(iInterestedAPIs == NULL);
+	
+	TRAPD(err, iInterestedAPIs = ExtractInterestedAPIsL(aMessage));
+	
+	iServer.ControllerClientAvailable();
+
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConControllerSession::GoConnectionOriented(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( !iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicAlreadyConnectionOriented);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() || iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+	if (iSending != ENotSending)
+		{
+		DoSendCancel();
+		}
+	EmptySendQueue();
+	
+	// Get the desired address from the message and check it.
+	const TUid uid = TUid::Uid(aMessage.Int0());
+	LOG1(_L("\tuid = 0x%08x"), uid);
+	// Check the requested bearer exists.
+	TBool bearerExists = iBearerManager.BearerExists(uid);
+	if ( !bearerExists)
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerPluginIncorrectInterface);
+		return;
+		}
+	// Check the bearer-specific part of the address.
+	TBuf8<TRemConAddress::KMaxAddrSize> buf;
+	TInt err = aMessage.Read(1, buf);
+	if ( err != KErrNone )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return;
+		}
+
+	// Do security check- if this client won't be allowed to use the bearer 
+	// then fail the request. 
+	// NB This security check (repeated in debug at ConnectBearer and 
+	// DisconnectBearer time) is all that stands between a connection-oriented 
+	// client and the bearer, and is all the caps checking that RemCon does!
+	err = KErrPermissionDenied;
+	if ( iBearerManager.CheckPolicy(uid, aMessage) )
+		{
+		err = KErrNone;
+		}
+		
+		
+	// if alls well and we're connection oriented then set up as such
+	if (KErrNone == err)
+		{
+		// The client has passed all our checks- set our data member.
+		iRemoteAddress.BearerUid() = uid;
+		iRemoteAddress.Addr() = buf;
+		// tell the server
+		iServer.ClientGoConnectionOriented(*this,uid);
+		}
+				
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConControllerSession::GoConnectionless(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() || iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+	
+	if (iSending != ENotSending)
+		{
+		DoSendCancel();
+		}
+	EmptySendQueue();
+	
+	// we will need to tell the server which bearer this used to be connected to
+	// this enables the server to not inform a bearer that is already connected
+	// that its been connected
+	TUid oldUid = iRemoteAddress.BearerUid();
+	
+	iRemoteAddress.BearerUid() = KNullUid;	
+
+	// tell the server
+	iServer.ClientGoConnectionless(*this, oldUid);
+
+	CompleteClient(aMessage, KErrNone);
+	}
+
+void CRemConControllerSession::ConnectBearer(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	if ( iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
+		return;
+		}
+
+	// Check the requested bearer exists.
+	TBool bearerExists = iBearerManager.BearerExists(iRemoteAddress.BearerUid());
+	// This check was done at GoConnectionOriented time.
+	ASSERT_DEBUG(bearerExists);
+	// So was this one.
+	ASSERT_DEBUG(iBearerManager.CheckPolicy(iRemoteAddress.BearerUid(), aMessage));
+
+	// Check the state of our given connection at the bearer level. If it is: 
+	// -) disconnected request the connection to come up,
+	// -) connecting or disconnecting, add message to the queue of pending 
+	//		messages, and process it once connecting/disconnecting has been completed
+	// -) connected, complete the client's message,
+
+	TConnectionState conState;
+	conState = iServer.ConnectionState(iRemoteAddress);
+
+	if ( conState == EDisconnected )
+		{
+		// The bearer may indicate connection synchronously, so set this 
+		// message _before_ we ask them
+		iConnectBearerMsg = aMessage;
+		TInt err = iBearerManager.Connect(iRemoteAddress);
+		if ( err != KErrNone )
+			{
+			CompleteClient(iConnectBearerMsg, err);
+			}
+		}
+	else if ( conState == EDisconnecting ||  conState == EConnecting )
+		{
+		if ( iPendingMsg.Handle() )
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+			return;
+			}
+		// Store the message, it will get processed later.
+		iPendingMsg = aMessage;
+		}
+	else // EConnected
+		{
+		CompleteClient(aMessage, KErrNone);
+		}
+		
+	}
+
+void CRemConControllerSession::ConnectBearerCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iConnectBearerMsg.Handle() )
+		{
+		CompleteClient(iConnectBearerMsg, KErrCancel);
+		}
+	else if ( iPendingMsg.Handle() && ( iPendingMsg.Function() == ERemConConnectBearer ))
+		{
+		CompleteClient(iPendingMsg, KErrCancel);
+		}
+		
+	CompleteClient(aMessage, KErrNone);
+	// At no point do we make any change to the processes going on underneath
+	// us- 'Cancel' APIs are just for cancelling interest in an async
+	// operation.
+	}
+
+void CRemConControllerSession::DisconnectBearer(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iDisconnectBearerMsg.Handle() || iConnectBearerMsg.Handle() || iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	if ( iRemoteAddress.IsNull() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
+		return;
+		}
+
+	if (iSending != ENotSending)
+		{
+		DoSendCancel();
+		}
+	EmptySendQueue();
+	
+	// Check the requested bearer exists.
+	TBool bearerExists = iBearerManager.BearerExists(iRemoteAddress.BearerUid());
+	// This check was done at GoConnectionOriented time.
+	ASSERT_DEBUG(bearerExists);
+	// So was this one.
+	ASSERT_DEBUG(iBearerManager.CheckPolicy(iRemoteAddress.BearerUid(), aMessage));
+
+	// Check the state of the given connection. If it is:
+	// -) connected, request connection to go away,
+	// -) disconnected, compete the client's message,
+	// -) connecting or disconnecting, add message to the queue of pending 
+	//		messages, and process it once connecting/disconnecting has been completed
+
+	TInt err;
+	TConnectionState conState;
+	conState = iServer.ConnectionState(iRemoteAddress);
+
+	if ( conState == EConnected )
+		{
+		// The bearer may indicate disconnection synchronously, so set this 
+		// message _before_ we ask them
+		iDisconnectBearerMsg = aMessage;
+		err = iBearerManager.Disconnect(iRemoteAddress);
+		if ( err != KErrNone )
+			{
+			CompleteClient(iDisconnectBearerMsg, err);
+			}
+		}
+	else if ( conState == EDisconnecting ||  conState == EConnecting )
+		{
+		if ( iPendingMsg.Handle() )
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+			return;
+			}
+		// Store the message, it will get processed later.
+		iPendingMsg = aMessage;
+		}
+	else //disconnected
+		{
+		CompleteClient(aMessage, KErrNone);	
+		}
+	}
+
+void CRemConControllerSession::DisconnectBearerCancel(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		CompleteClient(iDisconnectBearerMsg, KErrCancel);
+		}
+	else if ( iPendingMsg.Handle() && (iPendingMsg.Function() == ERemConDisconnectBearer ))
+		{
+		CompleteClient(iPendingMsg, KErrCancel);
+		}
+		
+	CompleteClient(aMessage, KErrNone);
+	}
+
+/**
+Sends a notify message to the remote device.
+
+This function is intended for the RemCon controller client to send a notify
+command to the remote device.
+*/
+void CRemConControllerSession::SendNotify(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we're not already sending...
+	if ( iSendMsg.Handle())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicSendAlreadyOutstanding);
+		return;
+		}
+	
+	iSendMsg = aMessage;
+	
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	// Check we don't have a disconnect outstanding- this makes no sense from 
+	// a client viewpoint (they should cancel the disconnect first).
+	// [The client is allowed to have a connect request outstanding- the 
+	// bearer manager makes sure a bearer-level connect is not posted on the 
+	// same address twice.]
+	if ( iDisconnectBearerMsg.Handle() )
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
+		return;
+		}
+
+	TRAPD(err, DoSendNotifyL(aMessage));
+	if ( err != KErrNone )
+		{
+		CompleteClient(aMessage, err);
+		}
+	}
+
+/**
+@see CRemConControllerSession::SendNotify
+*/
+void CRemConControllerSession::DoSendNotifyL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	const TUid interfaceUid = TUid::Uid(aMessage.Int0());
+	LOG1(_L("\tinterfaceUid = 0x%08x"), interfaceUid);
+
+	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return;
+		}
+
+	TPckgBuf<TOperationInformation> opInfoPckg;	
+	TInt err= aMessage.Read(
+			1, // location of the descriptor in the client's message (as we expect them to have set it up)
+			opInfoPckg, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+	
+	if ( err != KErrNone )
+		{
+		LOG1(_L("\taMessage.Read = %d"), err);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return;
+		}	
+	
+	const TUint operationId = opInfoPckg().iOperationId;
+	LOG1(_L("\toperationId = 0x%02x"), operationId);
+	
+	const TRemConMessageSubType messageSubType = opInfoPckg().iMessageSubType;
+	LOG1(_L("\tmessageSubType = 0x%02x"), messageSubType);
+	
+	const TUint dataLength = (TUint)aMessage.GetDesLengthL(2);
+	LOG1(_L("\tdataLength = %d"), dataLength);
+	
+	// If the client wanted to send some operation-associated data, read it 
+	// from them.
+	RBuf8 sendDes;
+	if ( dataLength != 0 )
+		{
+		sendDes.CreateL(dataLength);
+		TInt err = aMessage.Read(
+			2, // location of the descriptor in the client's message (as we expect them to have set it up)
+			sendDes, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
+		// descriptor is a panicking offence for them, not an 'error the 
+		// request' offence.
+		if ( err != KErrNone )
+			{
+			LOG1(_L("\taMessage.Read = %d"), err);
+			sendDes.Close();
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			return;
+			}
+		}
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	CRemConMessage* msg = NULL;
+	
+	if (messageSubType != ERemConNotifyCommandAwaitingInterim)
+		{
+		sendDes.Close();
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+		return;
+		}
+	
+	CleanupClosePushL(sendDes);
+	msg = CRemConMessage::NewL(
+			iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
+			ERemConNotifyCommand, 
+			messageSubType,
+			interfaceUid,
+			operationId,
+			sendDes, // msg takes ownership
+			Id(), // session id for when the response comes back
+			0, // we let the bearer manager invent a new transaction id when the message gets to it
+			ETrue);	
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+	
+	LOG(_L("\tCONTROLLER send"));
+	ASSERT_DEBUG(iSendQueue);
+	if (iSending != ENotSending || !iSendQueue->IsEmpty())
+		{
+		iSendQueue->Append(*msg);
+		}
+	else
+		{
+		SendToServer(*msg);
+		}
+	}
+
+void CRemConControllerSession::SendToServer(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	// Set our completion members.
+	NumRemotes() = 0;
+	NumRemotesToTry() = 0;
+	SendError() = KErrNone;
+
+	
+	iSending = (aMsg.IsReliableSend()) ? ESendingReliable: ESendingUnreliable;
+	
+	iServer.SendCommand(aMsg);
+	}
+
+void CRemConControllerSession::EmptySendQueue()
+	{
+	LOG_FUNC;
+
+	ASSERT_DEBUG(!iSendMsg.Handle())
+	ASSERT_DEBUG(iSendNextCallBack);
+	iSendNextCallBack->Cancel();
+	CRemConMessage* msg;
+	ASSERT_DEBUG(iSendQueue);
+	TSglQueIter<CRemConMessage>& iter = iSendQueue->SetToFirst();
+	while ((msg = iter++) != NULL)
+		{
+		iSendQueue->RemoveAndDestroy(*msg);
+		}
+	}
+
+void CRemConControllerSession::DoSendCancel()
+	{
+	LOG_FUNC;
+	// We must tell the server, and pull the CRemConMessage from the 
+	// 'outgoing pending TSP' queue if it's on it. If the TSP is currently 
+	// processing the CRemConMessage, we must tell it to stop before we 
+	// can complete the RMessage2 iSendMsg- the TSP might still be 
+	// dereferencing bits of it. (The TSP is given iSendMsg so it can 
+	// access the client's secure ID and do a capability check.)
+	// NB This only matters for commands- responses don't go through the 
+	// TSP.
+	// Not also that this processing *stops* this 
+	// CRemConSession::SendCancel method from being the very simple 'I'm 
+	// no longer interested in the completion of the asynchronous request' 
+	// type of API it (and all cancels) should be. It actually does work 
+	// as well. As long as this work is implemented _synchronously_, we 
+	// should be OK.
+	iServer.SendCancel(*this);
+
+	NumRemotesToTry() = 0;
+	iSendError = KErrCancel;
+	CompleteSend();
+	}
+
+void CRemConControllerSession::CompleteMessage(const CRemConMessage& aMessage)
+	{
+	LOG_FUNC;
+
+	switch (aMessage.MsgType())
+		{
+	case ERemConCommand:
+	case ERemConResponse:
+	case ERemConReject:
+		{
+		CompleteSend();
+		break;
+		}
+	case ERemConNotifyCommand:
+		{
+		CompleteSendNotify();
+		break;
+		}
+	default:
+		ASSERT_DEBUG(EFalse);
+		break;
+		}
+
+	}
+
+void CRemConControllerSession::DoReceive()
+	{
+	// Request messages from the server for this controller session.
+	// If there's anything waiting to be given to us, ReceiveRequest will call 
+	// back to us with it.
+	iServer.ReceiveRequest(*this);	
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendResult(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC;
+
+	// We should not already be sending a message to n remotes
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+
+	SendError() = aError;
+	CompleteMessage(aMessage);
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& /*aMessage*/, TUint aNumRemotes)
+	{
+	LOG_FUNC;
+
+	// We should not already be sending a message
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+
+	NumRemotes() = 0;
+	NumRemotesToTry() = aNumRemotes;
+	SendError() = KErrNone;
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& /*aMessage*/, TUint /*aNumRemotes*/)
+	{
+	LOG_FUNC;
+
+	// This method should never be called, as it is not required to support controller sessions.
+	ASSERT_DEBUG(EFalse);
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC;
+
+	// We should not already be sending a message
+	ASSERT_DEBUG(NumRemotesToTry() == 0);
+
+	NumRemotes() = 0;
+	SendError() = aError;
+	CompleteMessage(aMessage);
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC;
+
+	// Ignore notification if client has been completed
+	if (NumRemotesToTry() > 0)
+		{
+		// Only set error if different from KErrNone
+		if (aError == KErrNone)
+			{
+			++NumRemotes();
+			}
+		else
+			{
+			SendError() = aError;
+			}
+
+		--NumRemotesToTry();
+		if (NumRemotesToTry() == 0)
+			{
+			CompleteMessage(aMessage);
+			}
+		}
+	}
+
+void CRemConControllerSession::MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& /*aMessage*/)
+	{
+	LOG_FUNC;
+
+	// This method should never be called, as it is not required to support controller sessions.
+	ASSERT_DEBUG(EFalse);
+	}
--- a/accessoryservices/remotecontrolfw/server/src/server.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/src/server.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -26,7 +26,9 @@
 #include <remcon/remconbearerinterface.h>
 #include <remcon/remconbearerbulkinterface.h>
 #include "server.h"
-#include "session.h"
+#include "targetclientprocess.h"
+#include "controllersession.h"
+#include "targetsession.h"
 #include "serversecuritypolicy.h"
 #include "utils.h"
 #include "bearermanager.h"
@@ -44,7 +46,8 @@
 PANICCATEGORY("server");
 
 #ifdef __FLOG_ACTIVE
-#define LOGSESSIONS							LogSessions()
+#define LOGCONTROLLERSESSIONS				LogControllerSessions()
+#define LOGTARGETSESSIONS					LogTargetSessions()
 #define LOGREMOTES							LogRemotes()
 #define LOGCONNECTIONHISTORYANDINTEREST		LogConnectionHistoryAndInterest()
 #define LOGOUTGOINGCMDPENDINGTSP			LogOutgoingCmdPendingTsp()
@@ -58,7 +61,8 @@
 #define LOGINCOMINGPENDINGDELIVERY			LogIncomingPendingDelivery()
 #define LOGINCOMINGDELIVERED				LogIncomingDelivered()
 #else
-#define LOGSESSIONS
+#define LOGCONTROLLERSESSIONS
+#define LOGTARGETSESSIONS
 #define LOGREMOTES
 #define LOGCONNECTIONHISTORYANDINTEREST
 #define LOGOUTGOINGCMDPENDINGTSP
@@ -74,6 +78,20 @@
 #endif // __FLOG_ACTIVE
 
 TInt BulkMain(TAny* aParam);
+TBool ControllerSessionCompare(const TUint* aSessionId, const CRemConControllerSession& aSession)
+	{
+	return *aSessionId == aSession.Id();
+	}
+
+TBool TargetClientCompareUsingSessionId(const TUint* aClientId, const CRemConTargetClientProcess& aClient)
+	{
+	return *aClientId == aClient.Id();
+	}
+
+TBool TargetClientCompareUsingProcessId(const TProcessId* aProcessId, const CRemConTargetClientProcess& aClient)
+	{
+	return *aProcessId == aClient.ClientInfo().ProcessId();
+	}
 
 CRemConServer* CRemConServer::NewLC()
 	{
@@ -97,9 +115,11 @@
 	// There should be no watcher as there should be no bulk thread running
 	ASSERT_DEBUG(!iBulkThreadWatcher);
 
-	iSessionsLock.Wait();
-	iSessions.Close();
-	iSessionsLock.Close();
+	iControllerSessions.Close();
+
+	iTargetClientsLock.Wait();
+	iTargetClients.Close();
+	iTargetClientsLock.Close();
 
 	// Destroy TSP before iIncomingPendingAddress in case the TSP is 
 	// addressing a message on it at the time.
@@ -178,7 +198,7 @@
 	LOG_FUNC;
 	// Open ECOM session.
 	iEcom = &(REComSession::OpenL());
-	LEAVEIFERRORL(iSessionsLock.CreateLocal());
+	LEAVEIFERRORL(iTargetClientsLock.CreateLocal());
 
 	iShutdownTimer = CPeriodic::NewL(CActive::EPriorityStandard);
 
@@ -230,29 +250,35 @@
 	LOG3(_L("\taVersion = (%d,%d,%d)"), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild);
 		
 	// Version number check...
-	TVersion v(KRemConSrvMajorVersionNumber,
-		KRemConSrvMinorVersionNumber,
-		KRemConSrvBuildNumber);
-
-	if ( !User::QueryVersionSupported(v, aVersion) )
+	if ( aVersion.iMajor != KRemConSrvMajorVersionNumber || aVersion.iMinor != KRemConSrvMinorVersionNumber )
 		{
 		LEAVEIFERRORL(KErrNotSupported);
 		}
 
+	// We need a non-const copy of ourself so that:
+	// (a) New target clients may be added to iTargetClients (controller sessions are added to 
+	// iControllerSessions when ControllerClientOpened() is invoked).
+	// (b) We may provide new sessions/clients with a non-const pointer to ourself.
 	CRemConServer* ncThis = const_cast<CRemConServer*>(this);
-	
+
 	CRemConSession* sess = NULL;
 	ASSERT_DEBUG(iBearerManager);
-	TRAPD(err, sess = CRemConSession::NewL(*ncThis, 
-				*iBearerManager, 
-				aMessage, 
-				(ncThis->iSessionId)++)
-			);
-	if ( err != KErrNone )
+
+	TInt err = KErrNotSupported;	
+	if (aVersion.iBuild == KRemConSrvControllerSession)
+		{
+		TRAP(err, sess = ncThis->CreateControllerSessionL(aMessage));
+		}
+	else if(aVersion.iBuild == KRemConSrvTargetSession)
+		{
+		TRAP(err, sess = ncThis->CreateTargetSessionL(aMessage));
+		}
+	
+	if ( err != KErrNone)
 		{
 		// Session creation might have failed- if it has we need to check if 
 		// we need to shut down again.
-		const_cast<CRemConServer*>(this)->StartShutdownTimerIfNoSessionsOrBulkThread();
+		const_cast<CRemConServer*>(this)->StartShutdownTimerIfNoClientsOrBulkThread();
 		LEAVEIFERRORL(err);
 		}
 
@@ -260,11 +286,85 @@
 	return sess;
 	}
 
-void CRemConServer::StartShutdownTimerIfNoSessionsOrBulkThread()
+CRemConControllerSession* CRemConServer::CreateControllerSessionL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	CRemConControllerSession* sess=NULL;
+
+	// Obtain client process ID.
+	TClientInfo clientInfo;
+	ClientProcessAndSecureIdL(clientInfo, aMessage);
+
+	// Create the session and return
+	sess = CRemConControllerSession::NewL(*this, *iBearerManager, clientInfo, iSessionOrClientId++);
+	return sess;
+	}
+
+CRemConTargetSession* CRemConServer::CreateTargetSessionL(const RMessage2& aMessage)
 	{
 	LOG_FUNC;
-	iSessionsLock.Wait();
-	if ( iSessions.Count() == 0 && !iBulkThreadOpen)
+
+	CRemConTargetSession* sess=NULL;
+	
+	// Obtain client process ID and search for clients server-side process representation.
+	TClientInfo clientInfo;
+	ClientProcessAndSecureIdL(clientInfo, aMessage);
+
+	// We search for the client ourselves here as we need to know where it
+	// is in the array if we end up needing to destroy it.
+	iTargetClientsLock.Wait();	
+	CleanupSignalPushL(iTargetClientsLock);
+
+	TInt clientIndex = iTargetClients.Find(clientInfo.ProcessId(), TargetClientCompareUsingProcessId);
+
+	if (clientIndex == KErrNotFound)
+		{
+		// Client is new, create process representation for client and add to iTargetClients 
+		CRemConTargetClientProcess* newClient = CRemConTargetClientProcess::NewLC(clientInfo, iSessionOrClientId++, *this, *iBearerManager);
+
+		iTargetClients.AppendL(newClient);
+
+		// Set clientIndex to point to the new client.
+		clientIndex = iTargetClients.Count()-1;
+
+		CleanupStack::Pop(newClient);
+		}
+
+	// Create session on client and return.
+	// On error, remove the clients process representation if client has no other sessions.
+	TRAPD(err, sess = iTargetClients[clientIndex]->NewSessionL(iSessionOrClientId++));
+	if (err)
+		{
+		TryToDropClientProcess(clientIndex);
+		LEAVEL(err);
+		}
+
+	CleanupStack::PopAndDestroy(&iTargetClientsLock);
+
+	return sess;
+	}
+
+void CRemConServer::ClientProcessAndSecureIdL(TClientInfo& aClientInfo, const RMessage2& aMessage) const
+	{
+	LOG_FUNC;
+
+	RThread thread;
+	LEAVEIFERRORL(aMessage.Client(thread));
+	CleanupClosePushL(thread);
+	RProcess process;
+	LEAVEIFERRORL(thread.Process(process));
+	aClientInfo.ProcessId() = process.Id();
+	process.Close();
+	aClientInfo.SecureId() = thread.SecureId();
+	CleanupStack::PopAndDestroy(&thread);
+	}
+
+void CRemConServer::StartShutdownTimerIfNoClientsOrBulkThread()
+	{
+	LOG_FUNC;
+	iTargetClientsLock.Wait();
+	if ( iControllerSessions.Count() == 0 && iTargetClients.Count() == 0 && !iBulkThreadOpen)
 		{
 		LOG(_L("\tno remaining sessions- starting shutdown timer"));
 		// Should have been created during our construction.
@@ -291,12 +391,37 @@
 			LOG(_L("\tshutdown timer was already active"));
 			}
 		}
-	iSessionsLock.Signal();
+	iTargetClientsLock.Signal();
+	}
+
+void CRemConServer::CancelShutdownTimer()
+	{
+	// Should have been created during our construction.		
+	ASSERT_DEBUG(iShutdownTimer);
+	iShutdownTimer->Cancel();
+	}
+
+void CRemConServer::TryToDropClientProcess(TUint aClientIndex)
+	{
+	ASSERT_DEBUG(iTargetClients.Count() > aClientIndex);
+	
+	iTargetClientsLock.Wait();
+	
+	CRemConTargetClientProcess* client = iTargetClients[aClientIndex]; 
+	if (client->TargetSessionCount() == 0)
+		{
+		// No sessions held by this client process representation, OK to destroy.
+		// The destructor of CRemConTargetClientProcess will call back to us, after which we will
+		// handle the client close.
+		delete client;
+		}
+	
+	iTargetClientsLock.Signal();
 	}
 
 TInt CRemConServer::TimerFired(TAny* aThis)
 	{
-	LOG_STATIC_FUNC
+	LOG_STATIC_FUNC;
 	static_cast<void>(aThis);
 	
 #if defined(__FLOG_ACTIVE) || defined(_DEBUG)
@@ -316,7 +441,7 @@
 
 void CRemConServer::InitialiseBulkServerThreadL()
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	// Set up the configuration of the thread
 	iBulkServerThread.SetPriority(EPriorityLess);
 	
@@ -361,7 +486,7 @@
 
 TInt CRemConServer::BulkServerRequired()
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	// If the bulk server is required then try to create it
 	TThreadFunction bulkServerThreadFunction(BulkMain);
 	_LIT(KBulkServerThreadName, "RemConBulkServerThread");
@@ -383,17 +508,16 @@
 	return err;
 	}
 
-TInt CRemConServer::ClientOpened(CRemConSession& aSession)
+TInt CRemConServer::ControllerClientOpened(CRemConControllerSession& aSession)
 	{
 	LOG_FUNC;
 	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
 
 	// Register the session by appending it to our array, and also making an 
 	// item for it in the record of which points in the connection history 
 	// sessions are interested in.
-	iSessionsLock.Wait();
-	TInt ret = iSessions.Append(&aSession);
+	TInt ret = iControllerSessions.Append(&aSession);
 	if ( ret == KErrNone )
 		{
 		TSessionPointerToConnectionHistory item;
@@ -402,10 +526,9 @@
 		ret = iSession2ConnHistory.Append(item);
 		if ( ret != KErrNone )
 			{
-			iSessions.Remove(iSessions.Count() - 1);
+			iControllerSessions.Remove(iControllerSessions.Count() - 1);
 			}
 		}
-	iSessionsLock.Signal();
 
 	if ( ret == KErrNone )
 		{
@@ -414,71 +537,74 @@
 		iShutdownTimer->Cancel();
 		}
 
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
 	LOG1(_L("\tret = %d"), ret);
 	return ret;
 	}
 
-// this function is called by the session when the session type is set
-void CRemConServer::ClientTypeSet(CRemConSession& aSession)
+TInt CRemConServer::RegisterTargetSessionPointerToConnHistory(const CRemConTargetSession& aSession)
+	{
+	LOG_FUNC;
+
+	TSessionPointerToConnectionHistory item;
+	item.iSessionId = aSession.Id();
+	item.iIndex = 0; // there is always at least one item in the connection history
+	TInt ret = iSession2ConnHistory.Append(item);
+
+	return ret;
+	}
+
+
+// this function is called by the client when it has registered its features
+void CRemConServer::TargetClientAvailable(const CRemConTargetClientProcess& aClient)
 	{
 	LOG_FUNC;
-	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
-	LOGSESSIONS;
-
-	/* When a client (session) has its type set (controller or target) then 
-	   it will still have a bearer uid of NullUid. In this case we want to 
-	   update any bearers which now have a controller or target count moving 
-	   (from 0) to 1. */
-
-	/* tell the bearer manager that someones set a client type
-	   The bearer manager maintains controller and target counts for all bearers
-	   and will tell bearers when they need to know things have changed */
+	LOG1(_L("\t&aClient = 0x%08x"), &aClient);
+	LOGTARGETSESSIONS;
+
 	ASSERT_DEBUG(iBearerManager);
-	iBearerManager->ClientTypeSet(aSession.Type() == ERemConClientTypeController);
-
-	LOGSESSIONS;
+	iBearerManager->TargetClientAvailable(aClient.Id(), aClient.PlayerType(), aClient.PlayerSubType(), aClient.Name());
+	if(iTspIf5)
+		{
+		iTspIf5->TargetClientAvailable(aClient.ClientInfo());
+		}
+
+	LOGTARGETSESSIONS;
 	}
 
-// this function is called by the session when the client has registered its features
-void CRemConServer::TargetClientAvailable(CRemConSession& aSession)
+void CRemConServer::TargetFeaturesUpdated(CRemConTargetClientProcess& aClient)
 	{
 	LOG_FUNC;
-	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
-	LOGSESSIONS;
+	LOG1(_L("\t&aClient = 0x%08x"), &aClient);
+	LOGTARGETSESSIONS;
 
 	ASSERT_DEBUG(iBearerManager);
-	iBearerManager->TargetClientAvailable(aSession.Id(), aSession.PlayerType(), aSession.PlayerSubType(), aSession.Name());
-	if(iTspIf5)
-		{
-		iTspIf5->TargetClientAvailable(aSession.ClientInfo());
-		}
-
-	LOGSESSIONS;
+	iBearerManager->TargetFeaturesUpdated(aClient.Id(), aClient.PlayerType(), aClient.PlayerSubType(), aClient.Name());
+
+	LOGTARGETSESSIONS;
 	}
 
 // this function is called by the session when the client has registered its features
 void CRemConServer::ControllerClientAvailable()
 	{
 	LOG_FUNC;
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
 
 	ASSERT_DEBUG(iBearerManager);
 	iBearerManager->ControllerClientAvailable();
 	
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
 	}
 
 // this function is called by the session when it goes connection oriented
-void CRemConServer::ClientGoConnectionOriented(CRemConSession& aSession, TUid aUid)
+void CRemConServer::ClientGoConnectionOriented(CRemConControllerSession& aSession, TUid aUid)
 	{
 	LOG_FUNC;
 	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
-	LOGSESSIONS;
-
-	(void)&aSession; // get rid of unused warning.
-	
-	ASSERT_DEBUG(aSession.Type() == ERemConClientTypeController);
+	LOGCONTROLLERSESSIONS;
+
+	(void)&aSession; // get rid of unused warning. We keep the param to enforce usage only
+					 // by controller sessions
 
 	/* now tell the bearer manager that someones went connection oriented
 	   The bearer manager maintains controller and target counts for all bearers
@@ -486,227 +612,306 @@
 	ASSERT_DEBUG(iBearerManager);
 	iBearerManager->ClientConnectionOriented(aUid);
 
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
 	}
 
 // this is called by the session when the client goes connectionless
-void CRemConServer::ClientGoConnectionless(CRemConSession& aSession, TUid aUid)
+void CRemConServer::ClientGoConnectionless(CRemConControllerSession& aSession, TUid aUid)
 	{
 	LOG_FUNC;
 	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
-	LOGSESSIONS;
-
-	(void)&aSession; // get rid of unused warning.
-	
-	ASSERT_DEBUG(aSession.Type() == ERemConClientTypeController);
+	LOGCONTROLLERSESSIONS;
+
+	(void)&aSession; // get rid of unused warning. We keep the param to enforce usage only
+					 // by controller sessions
+
 	/* now tell the bearer manager that someones went connection less
 	   The bearer manager maintains controller and target counts for all bearers
 	   and will tell bearers when they need to know things have changed */
 	ASSERT_DEBUG(iBearerManager);
 	iBearerManager->ClientConnectionless(aUid);
 
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
 	}
 
-// called by session when session is closed.
-void CRemConServer::ClientClosed(CRemConSession& aSession, TUid aUid)
+// called by controller session when closed.
+void CRemConServer::ControllerClientClosed(CRemConControllerSession& aSession, TUid aUid)
+	{
+	LOG_FUNC;
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
+	LOGCONTROLLERSESSIONS;
+
+	// Find this session in the array and remove it (if it's there).
+	TInt index = iControllerSessions.Find(&aSession);
+	if(index >= 0)
+		{
+		// We've found the session in our array.
+		// 1. Remove the session from our array.
+		iControllerSessions.Remove(index);
+		
+		// 2. Tell the bearers about the session going away, if it was the 
+		// last controller.
+		// If the session hasn't already set its type, then it doesn't 
+		// count (we won't have told the bearers about it to begin with).
+		// The bearer manager maintains controller and target counts for all bearers
+		// and will tell bearers when they need to know things have changed 
+		if (aSession.ClientAvailable())
+			{
+			ASSERT_DEBUG(iBearerManager);
+			iBearerManager->ClientClosed(ETrue, aUid, aSession.Id());
+			}
+
+		// 3. Remove queued messages belonging to this session that: 
+		// (a) are outgoing, awaiting access to the TSP 
+		// (OutgoingPendingTsp, OutgoingNotifyPendingTsp), 
+		// (b) are outgoing, awaiting a bearer connection 
+		// (OutgoingPendingSend), 
+		// (c) have been sent (OutgoingSent)
+		// (d) are pending delivery to this session 
+		// (IncomingPendingDelivery)
+
+		// (3)(a) Outgoing, waiting access to the TSP:
+		TSglQueIter<CRemConMessage>& cmdIter = OutgoingCmdPendingTsp().SetToFirst();
+		CRemConMessage* msg;
+		TBool first = ETrue;
+		while ( ( msg = cmdIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// If the message is currently being worked on by the 
+				// TSP, cancel the TSP before destroying it.
+				if ( iTspHandlingOutgoingCommand && first )
+					{
+					ASSERT_DEBUG(iTspIf);
+					iTspIf->CancelOutgoingCommand();
+					iTspHandlingOutgoingCommand = EFalse;
+					}
+				OutgoingCmdPendingTsp().RemoveAndDestroy(*msg);
+				}
+			first = EFalse;
+			}
+		
+		cmdIter = OutgoingNotifyCmdPendingTsp().SetToFirst();
+		first = ETrue;
+		while ( ( msg = cmdIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// If the message is currently being worked on by the 
+				// TSP, cancel the TSP before destroying it.
+				if ( iTspHandlingOutgoingNotifyCommand && first )
+					{
+					ASSERT_DEBUG(iTspIf3);
+					iTspIf3->CancelOutgoingNotifyCommand();
+					iTspHandlingOutgoingNotifyCommand = EFalse;
+					}
+				OutgoingNotifyCmdPendingTsp().RemoveAndDestroy(*msg);
+				}
+			first = EFalse;
+			}
+
+		// (3)(b) Outgoing, awaiting a bearer connection:
+		TSglQueIter<CRemConMessage>& sendIter = OutgoingPendingSend().SetToFirst();
+		while ( ( msg = sendIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// Only commands are sent by controllers
+				ASSERT_DEBUG(msg->MsgType() == ERemConCommand || msg->MsgType() == ERemConNotifyCommand);
+				OutgoingPendingSend().RemoveAndDestroy(*msg);
+				}
+			}
+
+		// (3)(c) Have been sent:
+		OutgoingSent().RemoveAndDestroy(aSession.Id());
+		
+		// (3)(d) Are pending delivery to this session:
+		TSglQueIter<CRemConMessage>& pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+		while ( ( msg = pendingDeliveryIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// Only responses or rejects are received by controllers
+				ASSERT_DEBUG(msg->MsgType() == ERemConResponse || msg->MsgType() == ERemConReject);
+				IncomingPendingDelivery().RemoveAndDestroy(*msg);
+				}
+			}
+
+		// (3)(e) Have been delivered to this session and are awaiting responses:
+		TSglQueIter<CRemConMessage>& deliveredIter = IncomingDelivered().SetToFirst();
+		while ( ( msg = deliveredIter++ ) != NULL )
+			{
+			if ( msg->SessionId() == aSession.Id() )
+				{
+				// Only responses or rejects are received by controllers
+				ASSERT_DEBUG(msg->MsgType() == ERemConResponse || msg->MsgType() == ERemConReject);
+				IncomingDelivered().RemoveAndDestroy(*msg);
+				}
+			}
+		}
+
+	// Also remove its record from the connection history record.
+	RemoveSessionFromConnHistory(aSession);
+	
+	StartShutdownTimerIfNoClientsOrBulkThread();
+
+	LOGCONTROLLERSESSIONS;
+	}
+
+/**
+Called by CRemConTargetClientProcess when a session is closing.
+We have some work to do here as we need to remove the messages pertaining to
+that session.
+**/
+void CRemConServer::TargetSessionClosed(CRemConTargetClientProcess& aClient, CRemConTargetSession& aSession)
 	{
 	LOG_FUNC;
 	LOG1(_L("\t&aSession = 0x%08x"), &aSession);
-	LOGSESSIONS;
-
-	iSessionsLock.Wait();
-	// Find this session in the array and remove it (if it's there).
-	const TUint sessCount = iSessions.Count();
-	for ( TUint ii = 0 ; ii < sessCount ; ++ii )
+	LOGTARGETSESSIONS;
+	
+	iTargetClientsLock.Wait();
+
+	// Find the client in our array (required for later removal)
+	TInt clientIndex = iTargetClients.Find(aClient.ClientInfo().ProcessId(), TargetClientCompareUsingProcessId);
+
+	// We should always find the client.
+	ASSERT_DEBUG(clientIndex > KErrNotFound);
+
+	// 1. Remove queued messages belonging to this session that:
+	// (a) are outgoing, awaiting access to the TSP 
+	// (OutgoingRspPendingTsp)
+	// (b) are outgoing, awaiting a bearer connection 
+	// (OutgoingPendingSend), 
+	// (c) have been sent (OutgoingSent)
+	// (d) are pending delivery to this session 
+	// (IncomingPendingDelivery)
+	// (e) have been delivered to this session and are awaiting 
+	// responses (IncomingDelivered).
+		
+	// (1)(a) Outgoing, awaiting access to the TSP
+	// First remove the client pertaining to this session from the message recipients list.
+	ASSERT_DEBUG(iMessageRecipientsList);
+	TSglQueIter<CMessageRecipients>& messageRecipientsIter = iMessageRecipientsList->Iter();
+	
+	messageRecipientsIter.SetToFirst();
+	CMessageRecipients* message;
+	while ((message = messageRecipientsIter++) != NULL)
 		{
-		if ( iSessions[ii] == &aSession )
+		// First we need to find the message - it could be in
+		// OutgoingRspPendingTsp, IncomingDelivered or IncomingPendingDelivery
+		CRemConMessage* msg;
+		msg = OutgoingRspPendingTsp().Message(message->TransactionId());
+			
+		if (!msg)
 			{
-			// We've found the session in our array.
-
-			// 1. Remove the session from our array.
-			iSessions.Remove(ii);
-
-			// 2a. Tell the TSP if the session that has gone away is a target
-			if((aSession.Type() == ERemConClientTypeTarget) && iTspIf5)
-				{
-				iTspIf5->TargetClientUnavailable(aSession.ClientInfo());
-				}
+			msg = IncomingDelivered().Message(message->TransactionId());
+			}
+		if (!msg)
+			{
+			msg = IncomingPendingDelivery().Message(message->TransactionId());
+			}
 			
-			// 2b. Tell the bearers about the session going away, if it was the 
-			// last controller or last target.
-			// If the session hasn't already set its type, then it doesn't 
-			// count (we won't have told the bearers about it to begin with).
-			// The bearer manager maintains controller and target counts for all bearers
-			// and will tell bearers when they need to know things have changed */
-			if ( aSession.Type() != ERemConClientTypeUndefined )
+		if(msg)
+			{
+			// Try to remove this client from the message (this does nothing if we were not a recipient).
+			message->RemoveAndDestroyClient(aSession.ClientInfo());
+			if (message->Clients().IsEmpty())
 				{
-				ASSERT_DEBUG(iBearerManager);
-				iBearerManager->ClientClosed(aSession.Type() == ERemConClientTypeController, aUid, aSession.Id());
+				iMessageRecipientsList->Messages().Remove(*message);
+				// Inform bearer that it won't be getting a response
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+
+				delete message;
 				}
-
-			// 3. Remove queued messages belonging to this session that: 
-			// (a) are outgoing, awaiting access to the TSP 
-			// (OutgoingPendingTsp, OutgoingNotifyPendingTsp), 
-			// (b) are outgoing, awaiting a bearer connection 
-			// (OutgoingPendingSend), 
-			// (c) have been sent (OutgoingSent)
-			// (d) are pending delivery to this session 
-			// (IncomingPendingDelivery)
-			// (e) have been delivered to this session and are awaiting 
-			// responses (IncomingDelivered).
-			TSglQueIter<CRemConMessage>& cmdIter = OutgoingCmdPendingTsp().SetToFirst();
-			CRemConMessage* msg;
-			TBool first = ETrue;
-			while ( ( msg = cmdIter++ ) != NULL )
-				{
-				if ( msg->SessionId() == aSession.Id() )
-					{
-					// If the message is currently being worked on by the 
-					// TSP, cancel the TSP before destroying it.
-					if ( iTspHandlingOutgoingCommand && first )
-						{
-						ASSERT_DEBUG(iTspIf);
-						iTspIf->CancelOutgoingCommand();
-						iTspHandlingOutgoingCommand = EFalse;
-						}
-					OutgoingCmdPendingTsp().RemoveAndDestroy(*msg);
-					}
-				first = EFalse;
-				}
-			
-			cmdIter = OutgoingNotifyCmdPendingTsp().SetToFirst();
-			first = ETrue;
-			while ( ( msg = cmdIter++ ) != NULL )
-				{
-				if ( msg->SessionId() == aSession.Id() )
-					{
-					// If the message is currently being worked on by the 
-					// TSP, cancel the TSP before destroying it.
-					if ( iTspHandlingOutgoingNotifyCommand && first )
-						{
-						ASSERT_DEBUG(iTspIf3);
-						iTspIf3->CancelOutgoingNotifyCommand();
-						iTspHandlingOutgoingNotifyCommand = EFalse;
-						}
-					OutgoingNotifyCmdPendingTsp().RemoveAndDestroy(*msg);
-					}
-				first = EFalse;
-				}
-
-			if ( aSession.Type() == ERemConClientTypeTarget )
+			}
+		}
+
+	TSglQueIter<CRemConMessage>& rspIter = OutgoingRspPendingTsp().SetToFirst();
+	CRemConMessage* msg;
+	TBool first = ETrue;
+	while ( ( msg = rspIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			// If the message is currently being worked on by the 
+			// TSP, cancel the TSP before destroying it.
+			if (iTspIf2 && iTspHandlingOutgoingResponse && first )
 				{
-				// Remove the clients from the DeliveredMessageClients list
-				ASSERT_DEBUG(iMessageRecipientsList);
-				TSglQueIter<CMessageRecipients>& messageRecipientsIter = iMessageRecipientsList->Iter();
-				
-				messageRecipientsIter.SetToFirst();
-				CMessageRecipients* message;
-				while ((message = messageRecipientsIter++) != NULL)
-					{
-					message->RemoveAndDestroyClient(aSession.ClientInfo());
-					if (message->Clients().IsEmpty())
-						{
-						iMessageRecipientsList->Messages().Remove(*message);
-						// Inform bearer that it won't be getting a response
-						
-						// First we need to find the command - it could be in
-						// OutgoingRspPendingTsp, IncomingDelivered or IncomingPendingDelivery
-						
-						CRemConMessage* msg;
-						
-						msg = OutgoingRspPendingTsp().Message(message->TransactionId());
-						
-						if (!msg)
-							{
-							msg = IncomingDelivered().Message(message->TransactionId());
-							}
-						if (!msg)
-							{
-							msg = IncomingPendingDelivery().Message(message->TransactionId());
-							}
-						
-						if(msg)
-							{
-							// As this is the last message with this transaction ID, it should have this session ID
-							ASSERT_DEBUG(msg->SessionId() == aSession.Id());
-	
-							// Now we've found the message, we can pass the reject to the bearer
-							// Send reject to the bearer
-							SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
-							}
-						delete message;
-						}
-					TSglQueIter<CRemConMessage>& rspIter = OutgoingRspPendingTsp().SetToFirst();
+				iTspIf2->CancelOutgoingResponse();
+				iTspHandlingOutgoingResponse = EFalse;
+				}
+			OutgoingRspPendingTsp().RemoveAndDestroy(*msg);
+			}
+		first = EFalse;
+		}
+
+	// (1)(b) Outgoing, awaiting a bearer connection:
+	TSglQueIter<CRemConMessage>& sendIter = OutgoingPendingSend().SetToFirst();
+	while ( ( msg = sendIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			if (msg->MsgType() == ERemConResponse)
+				{
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
+				}
+			OutgoingPendingSend().RemoveAndDestroy(*msg);
+			}
+		}
+
+	// (1)(c) Have been sent:
+	TSglQueIter<CRemConMessage>& haveSentIter = OutgoingSent().SetToFirst();
+	while ( ( msg = haveSentIter++ ) != NULL)
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			OutgoingSent().RemoveAndDestroy(*msg);
+			}
+		}
 	
-					CRemConMessage* msg;
-					TBool first = ETrue;
-					while ( ( msg = rspIter++ ) != NULL )
-						{
-						if ( msg->SessionId() == aSession.Id() )
-							{
-							// If the message is currently being worked on by the 
-							// TSP, cancel the TSP before destroying it.
-							if (iTspIf2 && iTspHandlingOutgoingResponse && first )
-								{
-								iTspIf2->CancelOutgoingResponse();
-								iTspHandlingOutgoingResponse = EFalse;
-								}
-							OutgoingRspPendingTsp().RemoveAndDestroy(*msg);
-							}
-						first = EFalse;
-						}
-					
-					}
-				}
-
-			TSglQueIter<CRemConMessage>& sendIter = OutgoingPendingSend().SetToFirst();
-			while ( ( msg = sendIter++ ) != NULL )
+	// (1)(d) Are pending delivery to this session:
+	TSglQueIter<CRemConMessage>& pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
+	while ( ( msg = pendingDeliveryIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			if (msg->MsgType() == ERemConNotifyCommand)
 				{
-				if ( msg->SessionId() == aSession.Id() )
-					{
-					if (msg->MsgType() == ERemConResponse)
-						{
-						SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
-						}
-					OutgoingPendingSend().RemoveAndDestroy(*msg);
-					}
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
 				}
-
-			OutgoingSent().RemoveAndDestroy(aSession.Id());
-			
-			TSglQueIter<CRemConMessage>& pendingDeliveryIter = IncomingPendingDelivery().SetToFirst();
-			while ( ( msg = pendingDeliveryIter++ ) != NULL )
+			IncomingPendingDelivery().RemoveAndDestroy(*msg);
+			}
+		}
+
+	// (1)(e) Have been delivered to this session and are awaiting responses:
+	TSglQueIter<CRemConMessage>& deliveredIter = IncomingDelivered().SetToFirst();
+	while ( ( msg = deliveredIter++ ) != NULL )
+		{
+		if ( aClient.Id() == msg->SessionId() && aSession.SupportedMessage(*msg) )
+			{
+			if (msg->MsgType() == ERemConNotifyCommand)
 				{
-				if ( msg->SessionId() == aSession.Id() )
-					{
-					if (msg->MsgType() == ERemConNotifyCommand)
-						{
-						SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
-						}
-					IncomingPendingDelivery().RemoveAndDestroy(*msg);
-					}
+				SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
 				}
-
-			TSglQueIter<CRemConMessage>& deliveredIter = IncomingDelivered().SetToFirst();
-			while ( ( msg = deliveredIter++ ) != NULL )
-				{
-				if ( msg->SessionId() == aSession.Id() )
-					{
-					if (msg->MsgType() == ERemConNotifyCommand)
-						{
-						SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
-						}
-					IncomingDelivered().RemoveAndDestroy(*msg);
-					}
-				}
-					
-			break;
-			} // End found session in our array
+			IncomingDelivered().RemoveAndDestroy(*msg);
+			}
 		}
-	iSessionsLock.Signal();
-
-	// Also remove its record from the connection history record.
+
+	// Remove the session's record from the connection history record.
+	RemoveSessionFromConnHistory(aSession);
+
+	// Finally, try to delete client process representation if it now has no sessions
+	TryToDropClientProcess(clientIndex);
+
+	iTargetClientsLock.Signal();
+	
+	LOGTARGETSESSIONS;
+	}
+
+void CRemConServer::RemoveSessionFromConnHistory(const CRemConSession& aSession)
+	{
+	LOG_FUNC;
+
 	const TUint count = iSession2ConnHistory.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
@@ -717,48 +922,93 @@
 			break;
 			}
 		}
-
-	StartShutdownTimerIfNoSessionsOrBulkThread();
-
-	LOGSESSIONS;
 	}
 
-TBool CRemConServer::TargetClientWithSameProcessId(TProcessId aProcId) const
+// called by client process representation on close.
+void CRemConServer::TargetClientClosed(CRemConTargetClientProcess& aClient)
 	{
 	LOG_FUNC;
-	LOG1(_L("\taProcId = %d"), static_cast<TUint>(aProcId));
-
-	TBool ret = EFalse;
-
-	const CRemConSession* const sess = TargetSession(aProcId);
-	if ( sess )
+	LOG1(_L("\t&aClient = 0x%08x"), &aClient);
+	LOGTARGETSESSIONS;
+
+	iTargetClientsLock.Wait();
+	// Find this client in the array and remove it (if it's there).
+	const TUint clientCount = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < clientCount ; ++ii )
 		{
-		ret = ETrue;
+		if ( iTargetClients[ii] == &aClient )
+			{
+			// We've found the client in our array.
+
+			// 1. Remove the client from our array.
+			iTargetClients.Remove(ii);
+
+			// 2a. Tell the TSP the client has gone away 
+			if(iTspIf5)
+				{
+				iTspIf5->TargetClientUnavailable(aClient.ClientInfo());
+				}
+			
+			// 2b. Tell the bearers about the client going away, if it was the 
+			// last target.
+			// If the client hasn't already set its type, then it doesn't 
+			// count (we won't have told the bearers about it to begin with).
+			// The bearer manager maintains controller and target counts for all bearers
+			// and will tell bearers when they need to know things have changed 
+			if (aClient.ClientAvailable())
+				{
+				ASSERT_DEBUG(iBearerManager);
+				iBearerManager->ClientClosed(EFalse, KNullUid, aClient.Id());
+				}
+					
+			break;
+			} // End found session in our array
 		}
-
-	LOG1(_L("\tret = %d"), ret);
-	return ret;
+	iTargetClientsLock.Signal();
+
+	StartShutdownTimerIfNoClientsOrBulkThread();
+
+	LOGTARGETSESSIONS;
 	}
 
 #ifdef __FLOG_ACTIVE
-void CRemConServer::LogSessions() const
+
+void CRemConServer::LogControllerSessions() const 
 	{
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
-	LOG1(_L("\tNumber of sessions = %d"), count);
+	const TUint count = iControllerSessions.Count();
+	LOG1(_L("\tNumber of controller sessions = %d"), count);
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		CRemConSession* const session = iSessions[ii];
+		CRemConSession* const session = iControllerSessions[ii];
 		ASSERT_DEBUG(session);
-		LOG5(_L("\t\tsession %d [0x%08x], Id = %d, Type = %d, ProcessId = %d"), 
+		LOG4(_L("\t\tsession %d [0x%08x], Id = %d, ProcessId = %d"), 
 			ii, 
 			session,
 			session->Id(),
-			session->Type(),
 			static_cast<TUint>(session->ClientInfo().ProcessId())
 			);
 		}
-	iSessionsLock.Signal();
+	}
+
+void CRemConServer::LogTargetSessions() const 
+	{
+	iTargetClientsLock.Wait();
+	
+	const TUint count = iTargetClients.Count();
+	LOG1(_L("\tNumber of target clients = %d"), count);
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		LOG5(_L("\t\tclient %d [0x%08x], Id = %d, ProcessId = %d, SessionCount = %d"), 
+			ii, 
+			client,
+			client->Id(),
+			static_cast<TUint>(client->ClientInfo().ProcessId()),
+			client->TargetSessionCount()
+			);
+		}
+	iTargetClientsLock.Signal();
 	}
 
 void CRemConServer::LogRemotes() const
@@ -807,17 +1057,15 @@
 
 	CRemConMessage& msg = OutgoingNotifyCmdPendingTsp().First();
 	ASSERT_DEBUG(msg.Addr().IsNull());
-	CRemConSession* const sess = Session(msg.SessionId());
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
 	// Session closure removes messages from the outgoing queue and cancels 
-	// the TSP request if relevant. If sess is NULL here, then this processing 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
 	// has gone wrong.
-	ASSERT_DEBUG(sess);
+	ASSERT_DEBUG(observer);
 	
-	sess->SendError() = KErrNone;
 	if ( (aError != KErrNone) || !aConnection)
 		{
-		sess->SendError() = aError;
-		sess->CompleteSendNotify();
+		observer->MrcmsoMessageSendResult(msg, aError);
 		}
 	else
 		{
@@ -828,8 +1076,7 @@
 			TRAPD(err, SendCmdToRemoteL(msg, *aConnection, sync));
 			if ( err || sync )
 				{
-				sess->SendError() = err;
-				sess->CompleteSendNotify();
+				observer->MrcmsoMessageSendResult(msg, err);
 				}
 			
 			delete aConnection;
@@ -888,18 +1135,19 @@
 	// possible that the TSP has called OutgoingCommandAddressed in response 
 	// to a PermitOutgoingCommand request.
 	ASSERT_DEBUG(msg.Addr().IsNull());
-	CRemConSession* const sess = Session(msg.SessionId());
+	// The observer is the session which generated the message.
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
 	// Session closure removes messages from the outgoing queue and cancels 
-	// the TSP request if relevant. If sess is NULL here, then this processing 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
 	// has gone wrong.
-	ASSERT_DEBUG(sess);
-	// The number of remotes the command was sent to.
-	sess->NumRemotes() = 0;
-	sess->SendError() = KErrNone;
+	ASSERT_DEBUG(observer);
+
+	TInt numRemotesToTry = 0;
+
 	if ( aError != KErrNone )
 		{
-		sess->SendError() = aError;
-		sess->NumRemotesToTry() = 0;
+		// Error prevented message send attempt from being made.
+		observer->MrcmsoMessageSendOneOrMoreAttemptFailed(msg, aError);
 		}
 	else
 		{
@@ -908,8 +1156,10 @@
 		TSglQueIter<TRemConAddress> iter(iTspConnections);
 		while ( iter++ )
 			{
-			++sess->NumRemotesToTry();
+			++numRemotesToTry;
 			}
+		// Notify session of send attempt.
+		observer->MrcmsoMessageSendOneOrMoreAttempt(msg, numRemotesToTry);
 		iter.SetToFirst();
 		// Try to connect and send a message to each specified remote.
 		TRemConAddress* conn;
@@ -918,8 +1168,8 @@
 			LOG2(_L("\tsending message to remote [0x%08x] BearerUid = 0x%08x"), 
 				conn, conn->BearerUid());
 
-			// We send to as many of the remotes as we can. We remember 
-			// how many remotes got sent to successfully, and complete the 
+			// We send to as many of the remotes as we can. The observer remembers 
+			// how many remotes got sent to successfully, and completes the 
 			// client's request with either KErrNone or _one of_ the 
 			// errors that were raised. 
 			TBool sync = EFalse;
@@ -929,15 +1179,7 @@
 				// We have finished trying to process this (copy of this) 
 				// message, so we can adjust our 'remotes' counter / 
 				// completion error.
-				if ( err == KErrNone )
-					{
-					++sess->NumRemotes();
-					}
-				else
-					{
-					sess->SendError() = err;
-					}
-				--sess->NumRemotesToTry();
+				observer->MrcmsoMessageSendOneOrMoreResult(msg, err);
 				}
 			// else we didn't actually make a send attempt because conn was 
 			// down. This particular message will undergo an actual 
@@ -949,10 +1191,6 @@
 			delete conn;
 			} // End while 
 		} // End if TSP addressed command OK
-	if ( sess->NumRemotesToTry() == 0 )
-		{
-		sess->CompleteSend();
-		}
 
 	// We've now finished with the addressed message, so destroy it.
 	OutgoingCmdPendingTsp().RemoveAndDestroy(msg);
@@ -995,11 +1233,12 @@
 	// possible that the TSP has called OutgoingCommandPermitted in response 
 	// to a AddressOutgoingCommand request.
 	ASSERT_DEBUG(!msg.Addr().IsNull());
-	CRemConSession* const sess = Session(msg.SessionId());
+	// The session is the observer
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
 	// Session closure removes messages from the outgoing queue and cancels 
-	// the TSP request if relevant. If sess is NULL here, then this processing 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
 	// has gone wrong.
-	ASSERT_DEBUG(sess);
+	ASSERT_DEBUG(observer);
 	TInt err = KErrPermissionDenied;
 	if ( aIsPermitted )
 		{
@@ -1007,25 +1246,18 @@
 		TRAP(err, SendCmdToRemoteL(msg, msg.Addr(), sync));
 		if ( err || sync )
 			{
-			// We made a send attempt at the bearer level. Complete the 
-			// client's message according to err.
-			--sess->NumRemotesToTry();
-			sess->NumRemotes() = ( err == KErrNone ) ? 1 : 0;
-			sess->SendError() = err;
-			sess->CompleteSend();
+			// We made a send attempt at the bearer level, notify observer.
+			observer->MrcmsoMessageSendOneOrMoreResult(msg, err);
 			}
 		// else the message is waiting until a bearer-level connection 
 		// comes up. Only then can we complete the client's message.
 		}
 	else
 		{
-		// The send wasn't permitted, so complete the client's message.
-		// This was a connection-oriented send, so we know the number of 
-		// remotes it was sent to is 0.
-		--sess->NumRemotesToTry();
-		sess->NumRemotes() = 0;
-		sess->SendError() = KErrPermissionDenied;
-		sess->CompleteSend();
+		// The send wasn't permitted, notify observer.
+		// This should complete the client's message, as we're connection oriented
+		// (so only one remote to send to).
+		observer->MrcmsoMessageSendOneOrMoreResult(msg, KErrPermissionDenied);
 		}
 
 	// We've now finished with the message, so destroy it.
@@ -1069,11 +1301,11 @@
 	// possible that the TSP has called OutgoingCommandPermitted in response 
 	// to a AddressOutgoingCommand request.
 	ASSERT_DEBUG(!msg.Addr().IsNull());
-	CRemConSession* const sess = Session(msg.SessionId());
+	MRemConMessageSendObserver* const observer = ControllerSession(msg.SessionId());
 	// Session closure removes messages from the outgoing queue and cancels 
-	// the TSP request if relevant. If sess is NULL here, then this processing 
+	// the TSP request if relevant. If observer is NULL here, then this processing 
 	// has gone wrong.
-	ASSERT_DEBUG(sess);
+	ASSERT_DEBUG(observer);
 	TInt err = KErrPermissionDenied;
 	if ( aIsPermitted )
 		{
@@ -1081,16 +1313,14 @@
 		TRAP(err, SendCmdToRemoteL(msg, msg.Addr(), sync));
 		if ( err || sync )
 			{
-			sess->SendError() = err;
-			sess->CompleteSendNotify();
+			observer->MrcmsoMessageSendResult(msg, err);
 			}
 		// else the message is waiting until a bearer-level connection 
 		// comes up. Only then can we complete the client's message.
 		}
 	else
 		{
-		sess->SendError() = KErrPermissionDenied;
-		sess->CompleteSendNotify();
+		observer->MrcmsoMessageSendResult(msg, KErrPermissionDenied);
 		}
 
 	// We've now finished with the message, so destroy it.
@@ -1119,24 +1349,24 @@
 	
 	iOutgoingRspPendingTsp->Remove(msg);
 	
-	CRemConSession* const sess = Session(msg.SessionId());	
+	CRemConTargetClientProcess* const client = TargetClient(msg.SessionId());
 	// Session closure removes messages from the outgoing queue and cancels 
-	// the TSP request if relevant. If sess is NULL here, then this processing 
+	// the TSP request if relevant. If client is NULL here, then this processing 
 	// has gone wrong.
-	ASSERT_DEBUG(sess);
+	ASSERT_DEBUG(client);
 
 	if (aIsPermitted)
 		{
 		ASSERT_DEBUG(iMessageRecipientsList);
 		iMessageRecipientsList->RemoveAndDestroyMessage(msg.TransactionId());
-		CompleteSendResponse(msg, *sess); // Ownership of msg is always taken
+		CompleteSendResponse(msg, *client); // Ownership of msg is always taken
 		}
 	else
 		{
 		CMessageRecipients* messageClients = iMessageRecipientsList->Message(msg.TransactionId());
 		if (messageClients)
 			{
-			messageClients->RemoveAndDestroyClient(sess->ClientInfo()); // Remove the current client info from the list
+			messageClients->RemoveAndDestroyClient(client->ClientInfo()); // Remove the current client info from the list
 			if (messageClients->Clients().IsEmpty())
 				{
 				iMessageRecipientsList->RemoveAndDestroyMessage(msg.TransactionId());
@@ -1145,12 +1375,9 @@
 				SendReject(msg.Addr(), msg.InterfaceUid(), msg.OperationId(), msg.TransactionId());
 				}
 			}
-		--sess->NumRemotesToTry();
-		sess->SendError() = KErrNone;
-		if (sess->NumRemotesToTry() == 0)
-			{
-			sess->CompleteSend();
-			}
+
+		// Notify client that a send attempt to a remote was abandoned.
+		client->MrcmsoMessageSendOneOrMoreAbandoned(msg);
 		delete &msg;
 		}
 	if (!iOutgoingRspPendingTsp->IsEmpty())
@@ -1193,14 +1420,14 @@
 			if ( aError == KErrNone && aClientInfo)
 				{
 				LOG1(_L("\t\tprocess ID %d"), static_cast<TUint>(aClientInfo->ProcessId()));
-				// Get the corresponding session.
-				CRemConSession* const sess = TargetSession(aClientInfo->ProcessId());
-				// NB The set of open sessions may have changed while the request 
-				// was out on the TSP. If the TSP indicates a session that has 
-				// gone away, then ignore that session. 
-				if ( sess )
+				// Get the corresponding client.
+				CRemConTargetClientProcess* const client = TargetClient(aClientInfo->ProcessId());
+				// NB The set of open clients may have changed while the request 
+				// was out on the TSP. If the TSP indicates a client that has 
+				// gone away, then ignore that client. 
+				if ( client )
 					{
-					TRAPD(err, DeliverCmdToClientL(msg, *sess));
+					TRAPD(err, DeliverCmdToClientL(msg, *client));
 					if (err == KErrNone)
 						{
 						cmdDelivered = ETrue;
@@ -1239,11 +1466,11 @@
 			if(aError == KErrNone && aClientInfo)
 				{
 				LOG1(_L("\t\tprocess ID %d"), static_cast<TUint>(aClientInfo->ProcessId()));
-				// Get the corresponding session.
-				CRemConSession* const sess = TargetSession(aClientInfo->ProcessId());
-				if (sess)
+				// Get the corresponding client.
+				CRemConTargetClientProcess* const client = TargetClient(aClientInfo->ProcessId());
+				if (client)
 					{
-					if (sess->Id() == msg.SessionId())
+					if (client->Id() == msg.SessionId())
 						{
 						// Don't do anything - it's already on IncomingDelivered
 						}
@@ -1260,7 +1487,7 @@
 								// was being readdressed.
 								msg.MsgSubType() = deliveredMsg->MsgSubType();
 								// Deliver to the client
-								TRAPD(err, DeliverCmdToClientL(msg, *sess));
+								TRAPD(err, DeliverCmdToClientL(msg, *client));
 								if (err == KErrNone)
 									{
 									// Only remove the current message if the delivery to the new client suceeded.
@@ -1332,18 +1559,18 @@
 
 void CRemConServer::MrctspoDoIncomingCommandPermitted(TBool aIsPermitted)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	
 	MrctspoDoIncomingCommandAddressed(aIsPermitted ? KErrNone : KErrAccessDenied);
 	}
 
 void CRemConServer::MrctspoDoIncomingNotifyPermitted(TBool aIsPermitted)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	
 	if(aIsPermitted)
 		{
-		TClientInfo* clientInfo = ClientIdToClientInfo(IncomingNotifyCmdPendingAddress().First().Client());
+		TClientInfo* clientInfo = TargetClientIdToClientInfo(IncomingNotifyCmdPendingAddress().First().Client());
 		MrctspoDoIncomingNotifyAddressed(clientInfo, KErrNone);
 		}
 	else
@@ -1367,7 +1594,7 @@
 	// The head item is at index 0. This function should only be called if the 
 	// queue is not empty.
 	CRemConMessage& msg = OutgoingCmdPendingTsp().First();
-	CRemConSession* const sess = Session(msg.SessionId());
+	CRemConControllerSession* const sess = ControllerSession(msg.SessionId());
 	// The session should exist- if it closed after asking to send this 
 	// message, then the message should have been removed from the outgoing 
 	// pending TSP queue at that time.
@@ -1390,7 +1617,7 @@
 	else
 		{
 		// Non-null address means it's awaiting permission to send.
-		sess->NumRemotesToTry() = 1;
+		sess->MrcmsoMessageSendOneOrMoreAttempt(msg, 1);
 		iTspIf->PermitOutgoingCommand(
 			msg.InterfaceUid(),
 			msg.OperationId(), 
@@ -1414,7 +1641,7 @@
 	// The head item is at index 0. This function should only be called if the 
 	// queue is not empty.
 	CRemConMessage& msg = OutgoingNotifyCmdPendingTsp().First();
-	CRemConSession* const sess = Session(msg.SessionId());
+	CRemConControllerSession* const sess = ControllerSession(msg.SessionId());
 	// The session should exist- if it closed after asking to send this 
 	// message, then the message should have been removed from the outgoing 
 	// pending TSP queue at that time.
@@ -1433,7 +1660,8 @@
 	else
 		{
 		// Non-null address means it's awaiting permission to send.
-		sess->NumRemotesToTry() = 1;
+		// As this is a notify command, we don't need to adjust NumRemotes() or 
+		// NumRemotesToTry() on the session.
 		iTspIf3->PermitOutgoingNotifyCommand(
 			msg.InterfaceUid(),
 			msg.OperationId(), 
@@ -1466,18 +1694,15 @@
 	if(msg.Client() == KNullClientId)
 		{
 		// Prepare the array of target process IDs for the TSP.
-		iSessionsLock.Wait();
-		const TUint count = iSessions.Count();
+		iTargetClientsLock.Wait();
+		const TUint count = iTargetClients.Count();
 		for ( TUint ii = 0 ; ii < count ; ++ii )
 			{
-			CRemConSession* const sess = iSessions[ii];
-			ASSERT_DEBUG(sess);
-			if ( sess->Type() == ERemConClientTypeTarget )
-				{
-				iTspIncomingCmdClients.AddLast(sess->ClientInfo());
-				}
+			CRemConTargetClientProcess* const client = iTargetClients[ii];
+			ASSERT_DEBUG(client);
+			iTspIncomingCmdClients.AddLast(client->ClientInfo());
 			}
-		iSessionsLock.Signal();
+		iTargetClientsLock.Signal();
 		
 		iTspIf->AddressIncomingCommand(
 			msg.InterfaceUid(),
@@ -1486,7 +1711,7 @@
 		}
 	else
 		{
-		iTspIncomingCmdClients.AddLast(*ClientIdToClientInfo(msg.Client()));
+		iTspIncomingCmdClients.AddLast(*TargetClientIdToClientInfo(msg.Client()));
 		ASSERT_DEBUG(iTspIf4);
 		iTspIf4->PermitIncomingCommand(
 			msg.InterfaceUid(),
@@ -1521,18 +1746,15 @@
 		if(msg.Client() == KNullClientId)
 			{
 			// Prepare the array of target process IDs for the TSP.
-			iSessionsLock.Wait();
-			const TUint count = iSessions.Count();
+			iTargetClientsLock.Wait();
+			const TUint count = iTargetClients.Count();
 			for ( TUint ii = 0 ; ii < count ; ++ii )
 				{
-				CRemConSession* const sess = iSessions[ii];
-				ASSERT_DEBUG(sess);
-				if ( sess->Type() == ERemConClientTypeTarget )
-					{
-					iTspIncomingNotifyCmdClients.AddLast(sess->ClientInfo());
-					}
+				CRemConTargetClientProcess* const client = iTargetClients[ii];
+				ASSERT_DEBUG(client);
+				iTspIncomingNotifyCmdClients.AddLast(client->ClientInfo());
 				}
-			iSessionsLock.Signal();
+			iTargetClientsLock.Signal();
 			
 			// Only send the notify to the TSP if there isn't an identical one on either incomingpendingdelivery or incomingdelivered
 			iTspIf2->AddressIncomingNotify(
@@ -1542,7 +1764,7 @@
 			}
 		else
 			{
-			iTspIncomingNotifyCmdClients.AddLast(*ClientIdToClientInfo(msg.Client()));
+			iTspIncomingNotifyCmdClients.AddLast(*TargetClientIdToClientInfo(msg.Client()));
 			ASSERT_DEBUG(iTspIf4);
 			iTspIf4->PermitIncomingNotify(
 				msg.InterfaceUid(),
@@ -1568,18 +1790,15 @@
 	// messages awaiting addressing).
 	// Prepare the array of target process IDs for the TSP.
 	iTspIncomingNotifyCmdClients.Reset();
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
+	iTargetClientsLock.Wait();
+	const TUint count = iTargetClients.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		CRemConSession* const sess = iSessions[ii];
-		ASSERT_DEBUG(sess);
-		if ( sess->Type() == ERemConClientTypeTarget )
-			{
-			iTspIncomingNotifyCmdClients.AddLast(sess->ClientInfo());
-			}
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		iTspIncomingNotifyCmdClients.AddLast(client->ClientInfo());
 		}
-	iSessionsLock.Signal();
+	iTargetClientsLock.Signal();
 	
 	// This function should only be called if we know this queue is not 
 	// empty.
@@ -1601,11 +1820,11 @@
 	while (!iTspHandlingOutgoingResponse && !OutgoingRspPendingTsp().IsEmpty())
 		{
 		CRemConMessage& msg = OutgoingRspPendingTsp().First();
-		CRemConSession* session = Session(msg.SessionId());
-		// The session should exist- if it closed after asking to send this 
+		CRemConTargetClientProcess* client = TargetClient(msg.SessionId());
+		// The client should exist- if it closed after asking to send this 
 		// message, then the message should have been removed from the outgoing 
 		// pending TSP queue at that time.		
-		ASSERT_DEBUG(session);
+		ASSERT_DEBUG(client);
 		ASSERT_DEBUG(iMessageRecipientsList);
 		CMessageRecipients* message = iMessageRecipientsList->Message(msg.TransactionId());
 
@@ -1617,7 +1836,7 @@
 				iTspIf2->PermitOutgoingResponse(
 						msg.InterfaceUid(),
 						msg.OperationId(),
-						session->ClientInfo(),
+						client->ClientInfo(),
 						message->ConstIter()
 						);
 				}
@@ -1628,10 +1847,7 @@
 			}
 		else
 			{
-			session->NumRemotes() = 0;
-			--session->NumRemotesToTry();
-			session->SendError() = KErrNone;
-			session->CompleteSend();
+			client->MrcmsoMessageSendOneOrMoreAbandoned(msg);
 			OutgoingRspPendingTsp().RemoveAndDestroy(msg);
 			}
 		}
@@ -1720,60 +1936,44 @@
 	LOG1(_L("\taSync = %d"), aSync);
 	}
 
-void CRemConServer::DeliverCmdToClientL(const CRemConMessage& aMsg, CRemConSession& aSess)
+void CRemConServer::DeliverCmdToClientL(const CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
 	{
 	LOG_FUNC;
 
 	ASSERT_DEBUG((aMsg.MsgType() == ERemConCommand) || (aMsg.MsgType() == ERemConNotifyCommand)); 
-	// Take a copy of the message and set the right session ID (important to 
-	// set the selected session's ID because this is how we match up the 
+	// Take a copy of the message and set the right client ID (important to 
+	// set the selected client's ID because this is how we match up the 
 	// client's response, if aMsg is a command). 
 	CRemConMessage* const newMsg = CRemConMessage::CopyL(aMsg);
-	newMsg->SessionId() = aSess.Id();
-	LEAVEIFERRORL(DeliverMessageToClient(*newMsg, aSess));
+	newMsg->SessionId() = aClient.Id();
+	LEAVEIFERRORL(DeliverMessageToClient(*newMsg, aClient));
 	}
 
-TInt CRemConServer::DeliverMessageToClient(CRemConMessage& aMsg, CRemConSession& aSess)
+TInt CRemConServer::DeliverMessageToClient(CRemConMessage& aMsg, CRemConControllerSession& aSess)
 	{
 	LOG_FUNC;
 	LOGINCOMINGPENDINGDELIVERY;
 	LOGINCOMINGDELIVERED;
+
+	// Controller clients only receive responses or rejects
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConResponse || aMsg.MsgType() == ERemConReject);
+
 	TInt err = KErrNone;
 
 	// First off check if the client supports this
 	if(!aSess.SupportedMessage(aMsg))
-        {
-        err = KErrArgument;
+		{
+		err = KErrArgument;
         
-        // 'Take ownership' of it by destroying it- it's finished with.
-        delete &aMsg;
-        }
+		// 'Take ownership' of it by destroying it- it's finished with.
+		delete &aMsg;
+		}
 	else if ( aSess.CurrentReceiveMessage().Handle() )
 		{
-		// If the client can take the message now put it on the right queue.
-
 		err = aSess.WriteMessageToClient (aMsg);
-		// If the message was a command, and it was delivered with no error, 
-		// then put it in the 'incoming delivered' log. Otherwise, delete it 
-		// because it's finished with.
-		if ((aMsg.MsgType() == ERemConCommand) || (aMsg.MsgType() == ERemConNotifyCommand))
-			{
-			if (err == KErrNone )
-				{
-				// We'll need to remember it for the response coming back.
-				IncomingDelivered().Append(aMsg); 
-				}
-			else
-				{
-				// 'Take ownership' of it by destroying it- it's finished with.
-				delete &aMsg;
-				}
-			}
-		else
-			{
-			// 'Take ownership' of it by destroying it- it's finished with.			
-			delete &aMsg;
-			}
+
+		// 'Take ownership' of it by destroying it- it's finished with.			
+		delete &aMsg;
 		}
 	else
 		{
@@ -1784,6 +1984,54 @@
 	LOGINCOMINGDELIVERED;
 	return err;
 	}
+
+TInt CRemConServer::DeliverMessageToClient(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	TInt err = KErrNone;
+
+	// Target clients only receive commands
+	ASSERT_DEBUG(aMsg.MsgType() == ERemConCommand || aMsg.MsgType() == ERemConNotifyCommand);
+
+	// Pass message to client
+	err = aClient.ReceiveMessage(aMsg);
+
+	if (err == KErrArgument)
+		{
+		// Message not supported.
+		// 'Take ownership' of it by destroying it- it's finished with.
+		delete &aMsg;
+		}
+	else if (err == KErrNotReady)
+		{
+		err = KErrNone;
+		// Client cannot receive this message at the moment.
+		IncomingPendingDelivery().Append(aMsg);	
+		}
+	else 
+		{
+		// If the message was delivered with no error, 
+		// then put it in the 'incoming delivered' log. Otherwise, delete it 
+		// because it's finished with.
+		if (err == KErrNone)
+			{
+			// We'll need to remember it for the response coming back.
+			IncomingDelivered().Append(aMsg); 
+			}
+		else
+			{
+			// 'Take ownership' of it by destroying it- it's finished with.
+			delete &aMsg;
+			}
+		}
+	
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	return err;
+	}
 														  
 void CRemConServer::MrctspoDoIncomingCommandAddressed(TInt aError)
 	{
@@ -1837,12 +2085,12 @@
 				while ( ( procId = iter++ ) != NULL )
 					{
 					LOG1(_L("\t\tprocess ID %d"), static_cast<TUint>(procId->ProcessId()));
-					// Get the corresponding session.
-					CRemConSession* const sess = TargetSession(procId->ProcessId());
-					// NB The set of open sessions may have changed while the request 
-					// was out on the TSP. If the TSP indicates a session that has 
-					// gone away, then ignore that session. 
-					if ( sess )
+					// Get the corresponding client.
+					CRemConTargetClientProcess* const client = TargetClient(procId->ProcessId());
+					// NB The set of open clients may have changed while the request 
+					// was out on the TSP. If the TSP indicates a client that has 
+					// gone away, then ignore that client. 
+					if ( client )
 						{
 						TInt err = KErrNone;
 						TClientInfo* clientInfo = NULL;
@@ -1850,7 +2098,7 @@
 						if (err == KErrNone)
 							{
 							// If we didn't manage to create the TClientInfo, we shouldn't deliver to the client
-							TRAP(err, DeliverCmdToClientL(msg, *sess));
+							TRAP(err, DeliverCmdToClientL(msg, *client));
 							}
 						if (err == KErrNone)
 							{
@@ -1935,19 +2183,19 @@
 	LOG_FUNC;
 	
 	TRemConClientId id = KNullClientId;
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
+	iTargetClientsLock.Wait();
+	const TUint count = iTargetClients.Count();
 	for(TUint i=0; i<count; i++)
 		{
-		CRemConSession* const sess = iSessions[i];
-		ASSERT_DEBUG(sess);
-		if(sess->ClientInfo().ProcessId() == aClientInfo.ProcessId())
+		CRemConTargetClientProcess* const client = iTargetClients[i];
+		ASSERT_DEBUG(client);
+		if(client->ClientInfo().ProcessId() == aClientInfo.ProcessId())
 			{
-			id = sess->Id();
+			id = client->Id();
 			break;
 			}
 		}
-	iSessionsLock.Signal();
+	iTargetClientsLock.Signal();
 	
 	if(id != KNullClientId)
 		{
@@ -2057,7 +2305,7 @@
 			}
 		else
 			{
-			CRemConSession* const sess = Session(aMsg.SessionId());
+			CRemConControllerSession* const sess = ControllerSession(aMsg.SessionId());
 			delete &aMsg;
 			ASSERT_DEBUG(sess);
 			sess->SendError() = KErrNotSupported;
@@ -2067,7 +2315,7 @@
 	
 	}
 
-void CRemConServer::SendResponse(CRemConMessage& aMsg, CRemConSession& aSess)
+void CRemConServer::SendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
 	{
 	LOG_FUNC;
 	LOGINCOMINGDELIVERED;
@@ -2084,9 +2332,10 @@
 	TSglQueIter<CRemConMessage>& iter = IncomingDelivered().SetToFirst();
 	CRemConMessage* msg;
 	TBool found = EFalse;
+	
 	while ( ( msg = iter++ ) != NULL )
 		{
-		if (	msg->SessionId() == aSess.Id()
+		if (	msg->SessionId() == aClient.Id()
 			&&	msg->InterfaceUid() == response->InterfaceUid()
 			&&	msg->OperationId() == response->OperationId()
 			&&  (
@@ -2098,7 +2347,6 @@
 			{
 			LOG1(_L("\tfound a matching item in the incoming delivered commands log: [0x%08x]"), msg);
 			found = ETrue;
-			++aSess.NumRemotesToTry();
 
 			// Set the right address and transaction id in the outgoing message
 			response->Addr() = msg->Addr();
@@ -2106,6 +2354,9 @@
 			
 			if(msg->MsgType() == ERemConCommand)
 				{
+				// Notify client (this shall go to one remote)
+				aClient.MrcmsoMessageSendOneOrMoreAttempt(*response, 1);
+			
 				// Check the normal command and response have the default subtype set
 				ASSERT_DEBUG(msg->MsgSubType() == ERemConMessageDefault && response->MsgSubType() == ERemConMessageDefault);
 
@@ -2124,6 +2375,9 @@
 				}
 			else
 				{
+				// Notify client (this may be a series of messages to remotes)
+				aClient.MrcmsoMessageSendOneOrMoreIncremental(*msg, 1);
+
 				// Check the command is a notify command
 				ASSERT_DEBUG(msg->MsgType() == ERemConNotifyCommand);
 				
@@ -2173,7 +2427,7 @@
 	while ((msg = rspIter++) != NULL)
 		{
 		OutgoingRspPendingSend().Remove(*msg);
-		CompleteSendResponse(*msg, aSess);
+		CompleteSendResponse(*msg, aClient);
 		}
 
 	
@@ -2184,25 +2438,19 @@
 	// Just drop the message.
 	if ( !found )
 		{
-		// Complete the message with KErrNone.  We have done all we can with
-		// it.  Any other error may encourage retries from the application,
-		// which would be useless in this situation.
-		aSess.NumRemotes() = 0;
-		aSess.SendError() = KErrNone;
+		// Inform client that message should be completed with KErrNone We 
+		// have done all we can with it.  Any other error may encourage 
+		// retries from the application, which would be useless in this situation.
+		aClient.MrcmsoMessageSendOneOrMoreAttemptFailed(aMsg, KErrNone);
 		delete &aMsg;
 		}
 	
-	if (aSess.NumRemotesToTry() == 0)
-		{
-		aSess.CompleteSend();
-		}
-
 	LOGOUTGOINGRSPPENDINGTSP;
 	LOGINCOMINGDELIVERED;
 	LOGOUTGOINGPENDINGSEND;
 	}
 
-void CRemConServer::CompleteSendResponse(CRemConMessage& aMsg, CRemConSession& aSess)
+void CRemConServer::CompleteSendResponse(CRemConMessage& aMsg, CRemConTargetClientProcess& aClient)
 	{
 	LOG_FUNC;
 	LOGOUTGOINGPENDINGSEND;
@@ -2221,19 +2469,12 @@
 			// We're already connected
 			// If the bearer couldn't send, we need to error the client.
 			TInt err = iBearerManager->Send(aMsg);
-			// Complete client's message. Bearer-level error means the 
-			// response got sent to zero remotes- bearer-level success 
-			// means it got sent to precisely 1.
-			--aSess.NumRemotesToTry();
-			if (err == KErrNone)
-				{
-				++aSess.NumRemotes();
-				}
-			aSess.SendError() = err;
-			if (aSess.NumRemotesToTry() == 0)
-				{
-				aSess.CompleteSend();
-				}
+			
+			// Inform client that message should be completed with err. 
+			// Bearer-level error means the response got sent to zero remotes- 
+			// bearer-level success means it got sent to precisely 1.
+			aClient.MrcmsoMessageSendOneOrMoreResult(aMsg, err);
+
 			// We've now finished with the response.
 			delete &aMsg;
 			break;
@@ -2248,11 +2489,8 @@
 			TInt err = iBearerManager->Connect(aMsg.Addr());
 			if ( err != KErrNone )
 				{
+				aClient.MrcmsoMessageSendOneOrMoreResult(aMsg, err);
 				OutgoingPendingSend().RemoveAndDestroy(aMsg);
-				aSess.NumRemotes() = 0;
-				--aSess.NumRemotesToTry();
-				aSess.SendError() = err;
-				aSess.CompleteSend();
 				}
 			break;
 			}
@@ -2349,7 +2587,7 @@
 	LOGOUTGOINGPENDINGSEND;
 	}
 
-void CRemConServer::SendCancel(CRemConSession& aSess)
+void CRemConServer::SendCancel(CRemConControllerSession& aSess)
 	{
 	LOG_FUNC;
 	LOGOUTGOINGCMDPENDINGTSP;
@@ -2359,7 +2597,7 @@
 	TBool first = ETrue;
 	while ( ( msg = iter++ ) != NULL )
 		{
-		// A client can only have one send outstanding at once, so there can 
+		// A session can only have one send outstanding at once, so there can 
 		// only be one message on the queue belonging to it.
 		if ( msg->SessionId() == aSess.Id() )
 			{
@@ -2409,7 +2647,7 @@
 			{
 			LOG1(_L("\tfound a matching item in the sent commands log: [0x%08x]"), cmd);
 			sentCommandFound = ETrue;
-			CRemConSession* const session = Session(cmd->SessionId());
+			CRemConControllerSession* const session = ControllerSession(cmd->SessionId());
 			// When sessions close, their messages are removed from the logs, 
 			// so the session here _should_ exist.
 			ASSERT_DEBUG(session);
@@ -2462,7 +2700,7 @@
 			{
 			LOG1(_L("\tfound a matching item in the sent commands log: [0x%08x]"), cmd);
 			sentCommandFound = ETrue;
-			CRemConSession* const session = Session(cmd->SessionId());
+			CRemConControllerSession* const session = ControllerSession(cmd->SessionId());
 			// When sessions close, their messages are removed from the logs, 
 			// so the session here _should_ exist.
 			ASSERT_DEBUG(session);
@@ -2595,47 +2833,60 @@
 	}
 #endif // __FLOG_ACTIVE
 
-CRemConSession* CRemConServer::Session(TUint aSessionId) const
+CRemConControllerSession* CRemConServer::ControllerSession(TUint aSessionId) const
 	{
-	CRemConSession* sess = NULL;
-
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
-	for ( TUint ii = 0 ; ii < count ; ++ii )
+	LOG_FUNC;
+
+	CRemConControllerSession* sess = NULL;
+	
+	TInt index = iControllerSessions.Find(aSessionId, ControllerSessionCompare);
+	
+	if(index >= 0)
 		{
-		CRemConSession* const temp = iSessions[ii];
-		ASSERT_DEBUG(temp);
-		if ( temp->Id() == aSessionId )
-			{
-			sess = temp;
-			break;
-			}
+		sess = iControllerSessions[index];
 		}
-	iSessionsLock.Signal();
 
 	return sess;
 	}
 
-CRemConSession* CRemConServer::TargetSession(TProcessId aProcessId) const
+CRemConTargetClientProcess* CRemConServer::TargetClient(TUint aClientId) const
 	{
-	CRemConSession* sess = NULL;
-
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
-	for ( TUint ii = 0 ; ii < count ; ++ii )
+	LOG_FUNC;
+
+	CRemConTargetClientProcess* client = NULL;
+
+	iTargetClientsLock.Wait();
+	
+	TInt index = iTargetClients.Find(aClientId, TargetClientCompareUsingSessionId);
+	
+	if(index >= 0)
 		{
-		CRemConSession* const temp = iSessions[ii];
-		ASSERT_DEBUG(temp);
-		if (	temp->ClientInfo().ProcessId() == aProcessId 
-			&&	temp->Type() == ERemConClientTypeTarget )
-			{
-			sess = temp;
-			break;
-			}
+		client = iTargetClients[index];
 		}
-	iSessionsLock.Signal();
-
-	return sess;
+
+	iTargetClientsLock.Signal();
+
+	return client;
+	}
+
+CRemConTargetClientProcess* CRemConServer::TargetClient(TProcessId aProcessId) const
+	{
+	LOG_FUNC;
+
+	CRemConTargetClientProcess* client = NULL;
+
+	iTargetClientsLock.Wait();
+	
+	TInt index = iTargetClients.Find(aProcessId, TargetClientCompareUsingProcessId);
+	
+	if(index >= 0)
+		{
+		client = iTargetClients[index];
+		}
+	
+	iTargetClientsLock.Signal();
+
+	return client;
 	}
 
 MRemConConverterInterface* CRemConServer::Converter(TUid aInterfaceUid, 
@@ -2652,7 +2903,7 @@
 	return iConverterManager->Converter(aInterfaceData, aBearerUid);
 	}
 
-void CRemConServer::ReceiveRequest(CRemConSession& aSession)
+void CRemConServer::ReceiveRequest(CRemConControllerSession& aSession)
 	{
 	LOG_FUNC;
 	LOGINCOMINGPENDINGDELIVERY;
@@ -2665,10 +2916,61 @@
 		{
 		if ( msg->SessionId() == aSession.Id() )
 			{
+			// Controllers receive responses or rejects only.
+			ASSERT_DEBUG(msg->MsgType() == ERemConResponse || msg->MsgType() == ERemConReject);
+
 			TInt err = aSession.WriteMessageToClient(*msg);
 			IncomingPendingDelivery().Remove(*msg);
-			if ( msg->MsgType() == ERemConCommand || msg->MsgType() == ERemConNotifyCommand)
+			
+			// 'Take ownership' of it by destroying it- it's finished with.
+			delete msg;				
+			
+			break;
+			}
+		}
+
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+	}
+
+void CRemConServer::ReceiveRequest(CRemConTargetClientProcess& aClient)
+	{
+	LOG_FUNC;
+	LOGINCOMINGPENDINGDELIVERY;
+	LOGINCOMINGDELIVERED;
+
+	// Messages are addressed to the client. Ask client to deliver any pending
+	// messages. For each delivered message, update ourselves accordingly.
+	
+	// Find the first message in IncomingPendingDelivery for this session.
+	TSglQueIter<CRemConMessage>& iter = IncomingPendingDelivery().SetToFirst();
+	CRemConMessage* msg;
+	while ( ( msg = iter++ ) != NULL )
+		{
+		if (msg->SessionId() == aClient.Id())
+			{
+			// Targets receive commands only.
+			ASSERT_DEBUG(msg->MsgType() == ERemConCommand || msg->MsgType() == ERemConNotifyCommand);
+
+			TInt err = aClient.ReceiveMessage(*msg);
+
+			if (err == KErrArgument)
 				{
+				// Message not supported by this client.
+				// 'Take ownership' of it by destroying it- it's finished with.
+				IncomingPendingDelivery().Remove(*msg);
+				delete msg;
+				}
+			else if (err == KErrNotReady)
+				{
+				// Client cannot receive this message at the moment, skip for now
+				// (message is already on the pemding queue).
+				}
+			else 
+				{
+				// Message delivered, remove from pending queue.
+				IncomingPendingDelivery().Remove(*msg);
+				
 				if (err == KErrNone )
 					{
 					// We'll need to remember it for the response coming back.
@@ -2682,7 +2984,7 @@
 					// If we aren't returned a client list, this means that the message has been delivered elsewhere
 					if (messageRecipients)
 						{
-						messageRecipients->RemoveAndDestroyClient (aSession.ClientInfo ());
+						messageRecipients->RemoveAndDestroyClient (aClient.ClientInfo ());
 
 						if ( messageRecipients->Clients().IsEmpty ())
 							{
@@ -2692,21 +2994,14 @@
 							SendReject(msg->Addr(), msg->InterfaceUid(), msg->OperationId(), msg->TransactionId());
 							}
 						}
-					
+
 					// 'Take ownership' of it by destroying it- it's finished with.
 					delete msg;
 					}
 				}
-			else
-				{
-				// 'Take ownership' of it by destroying it- it's finished with.
-				delete msg;				
-				}
-			
-			break;
 			}
 		}
-
+	
 	LOGINCOMINGPENDINGDELIVERY;
 	LOGINCOMINGDELIVERED;
 	}
@@ -2769,32 +3064,29 @@
 */
 TInt CRemConServer::ControllerSupportedInterfaces(RArray<TUid>& aSupportedInterfaces)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	ASSERT_DEBUG(aSupportedInterfaces.Count() == 0);
 	
 	TLinearOrder<TUid> uidCompare(&UidCompare);
 	RArray<TUid> sessionFeatures;
 	TInt err = KErrNone;
-	for(TInt i=0; i<iSessions.Count(); i++)
+	for(TInt i=0; i<iControllerSessions.Count(); i++)
 		{
-		ASSERT_DEBUG(iSessions[i]);
-		if(iSessions[i]->Type() == ERemConClientTypeController)
+		ASSERT_DEBUG(iControllerSessions[i]);
+		err = iControllerSessions[i]->SupportedInterfaces(sessionFeatures);
+		ASSERT_DEBUG(err == KErrNone || err == KErrNoMemory);
+		
+		if(!err)
 			{
-			err = iSessions[i]->SupportedInterfaces(sessionFeatures);
-			ASSERT_DEBUG(err == KErrNone || err == KErrNoMemory);
-			
-			if(!err)
+			for(TInt j=0; j<sessionFeatures.Count(); j++)
 				{
-				for(TInt j=0; j<sessionFeatures.Count(); j++)
-					{
-					// Ignore failure here, we're trying this best effort
-					// InsertInOrder is used rather than just bunging the
-					// interface on the end as we want no duplicates 
-					(void)aSupportedInterfaces.InsertInOrder(sessionFeatures[j], uidCompare);
-					}
+				// Ignore failure here, we're trying this best effort
+				// InsertInOrder is used rather than just bunging the
+				// interface on the end as we want no duplicates 
+				(void)aSupportedInterfaces.InsertInOrder(sessionFeatures[j], uidCompare);
 				}
-			sessionFeatures.Reset();
 			}
+		sessionFeatures.Reset();
 		}
 	
 	if(aSupportedInterfaces.Count() > 0)
@@ -2935,14 +3227,21 @@
 	// now KErrNone. In this case, sessions' notifications need completing.
 	if ( aError == KErrNone )
 		{
-		iSessionsLock.Wait();
-		const TUint count = iSessions.Count();
+		TUint count = iControllerSessions.Count();
 		for ( TUint ii = 0 ; ii < count ; ++ii )
 			{
-			ASSERT_DEBUG(iSessions[ii]);
-			iSessions[ii]->ConnectionsChanged();
+			ASSERT_DEBUG(iControllerSessions[ii]);
+			iControllerSessions[ii]->ConnectionsChanged();
 			}
-		iSessionsLock.Signal();
+		
+		iTargetClientsLock.Wait();
+		count = iTargetClients.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iTargetClients[ii]);
+			iTargetClients[ii]->ConnectionsChanged();
+			}
+		iTargetClientsLock.Signal();
 		}
 
 	// Complete the specific client request(s) that caused a ConnectRequest on 
@@ -2950,11 +3249,11 @@
 	// connect to, and will filter on the address we give them. NB This 
 	// function is called by ConnectIndicate as well as by ConnectConfirm, but 
 	// the client doesn't care which end brought the connection up. 
-	const TUint count = Sessions().Count();
+	const TUint count = iControllerSessions.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		ASSERT_DEBUG(Sessions()[ii]);
-		Sessions()[ii]->CompleteConnect(aAddr, aError);
+		ASSERT_DEBUG(iControllerSessions[ii]);
+		iControllerSessions[ii]->CompleteConnect(aAddr, aError);
 		}
 
 	// Any messages waiting on OutgoingPendingSend for this connection need to 
@@ -2966,13 +3265,26 @@
 		{
 		if ( msg->Addr() == aAddr )
 			{
-			CRemConSession* const sess = Session(msg->SessionId());
-			// The session should exist- if it doesn't then this message 
+			MRemConMessageSendObserver* observer  = TargetClient(msg->SessionId());
+			if(!observer)
+				{
+				observer = ControllerSession(msg->SessionId());
+				}
+#ifdef __DEBUG
+			else
+				{
+				// Message has matched to a target session, so it should not also match
+				// a controller session (we know the vice-versa is already true).
+				ASSERT_DEBUG(!ControllerSession(msg->SessionId()));
+				}
+#endif
+
+			// The session or client should exist- if it doesn't then this message 
 			// wasn't cleaned from OutgoingPendingSend correctly when the 
 			// session closed. The exceptions are Reject, which can be put
 			// on the queue without a session, and notify changed responses when they are being
 			// delivered to multiple controllers
-			ASSERT_DEBUG(sess || msg->MsgType() == ERemConReject || msg->MsgSubType() == ERemConNotifyResponseChanged);
+			ASSERT_DEBUG(observer || msg->MsgType() == ERemConReject || msg->MsgSubType() == ERemConNotifyResponseChanged);
 
 			if ( aError == KErrNone)
 				{
@@ -2987,46 +3299,20 @@
 					// deleted because we've finished with it.
 					moveToSent = ETrue;
 					}
-				if ( sess)
+				if ( observer && msg->MsgType() != ERemConReject )
 					{
-					if ( err == KErrNone)
-						{
-						++sess->NumRemotes();
-						}
-					else
-						{
-						sess->SendError ()= err;
-						}
+					observer->MrcmsoMessageSendOneOrMoreResult(*msg, err);
 					}
 				}
 			else
 				{
 				// No connection, remember the error.
-				if ( sess)
+				if ( observer )
 					{
-					sess->SendError ()= aError;
-					}
-				}
-			if ( sess)
-				{
-				--sess->NumRemotesToTry();
-
-				// If we have now dealt with all the messages on the 
-				// OutgoingPendingSend queue for this session, we can complete 
-				// their send. In this case we should by now have collected the 
-				// number of remotes and the send error. (NB A client can only 
-				// have one send outstanding at any one time; a client may have 
-				// more than one message on the 'pending send' queue if the TSP 
-				// said to send to more than one remote.)
-				// If the message is a notify then it can only have been sent to
-				// one Remote so the NumRemotesToTry is not used
-				if(msg->MsgType() == ERemConNotifyCommand)
-					{
-					sess->CompleteSendNotify();
-					}
-				else if ( sess->NumRemotesToTry ()== 0)
-					{
-					sess->CompleteSend ();
+					if (msg->MsgType() != ERemConReject)
+						{
+						observer->MrcmsoMessageSendOneOrMoreResult(*msg, aError);
+						}
 					}
 				}
 
@@ -3049,55 +3335,78 @@
 	return aError;
 	}
 
-void CRemConServer::RemoveConnection(const TRemConAddress& aAddr)
+void CRemConServer::RemoveConnection(const TRemConAddress& aAddr, TInt aError)
 	{
 	LOG_FUNC;
 	LOG1(_L("\taAddr.BearerUid = 0x%08x"), aAddr.BearerUid());
 	LOGREMOTES;
-
-	// We make a new item in the connection history and inform the sessions so 
-	// they can complete outstanding connection status notifications.
-
-	ASSERT_DEBUG(iConnectionHistory);
-	iConnectionHistory->Disconnection(aAddr);
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
-	for ( TUint ii = 0 ; ii < count ; ++ii )
+	
+	if(aError == KErrNone)
 		{
-		ASSERT_DEBUG(iSessions[ii]);
-		iSessions[ii]->ConnectionsChanged();
-		}
-	iSessionsLock.Signal();
+		// The connection has gone away
+
+		// We make a new item in the connection history and inform the sessions so 
+		// they can complete outstanding connection status notifications.
+	
+		ASSERT_DEBUG(iConnectionHistory);
+		iConnectionHistory->Disconnection(aAddr);
+
+		TUint count = iControllerSessions.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iControllerSessions[ii]);
+			iControllerSessions[ii]->ConnectionsChanged();
+			}
+		
+		iTargetClientsLock.Wait();
+		count = iTargetClients.Count();
+		for ( TUint ii = 0 ; ii < count ; ++ii )
+			{
+			ASSERT_DEBUG(iTargetClients[ii]);
+			iTargetClients[ii]->ConnectionsChanged();
+			}
+		iTargetClientsLock.Signal();
+		
+		// If there are any messages waiting on OutgoingPendingSend for this connection,
+		// we re-connect it - they'll be picked up in HandleConnection above.
 	
-	// If there are any messages waiting on OutgoingPendingSend for this connection,
-	// we re-connect it - they'll be picked up in HandleConnection above.
-
-	TSglQueIter<CRemConMessage> iter = OutgoingPendingSend().SetToFirst();
-	CRemConMessage* msg;
-	TBool needToReconnect = false;
-	while ( ( msg = iter++ ) != NULL )
-		{
-		if (msg->Addr() == aAddr)
+		TSglQueIter<CRemConMessage> iter = OutgoingPendingSend().SetToFirst();
+		CRemConMessage* msg;
+		TBool needToReconnect = false;
+		while ( ( msg = iter++ ) != NULL )
 			{
-			needToReconnect = true;
-			break;
+			if (msg->Addr() == aAddr)
+				{
+				needToReconnect = true;
+				break;
+				}
+			}
+		
+		if (needToReconnect)
+			{
+			ASSERT_DEBUG(iBearerManager);
+			TInt err = iBearerManager->Connect(aAddr);
+			if ( err != KErrNone )
+				{
+				// This fails if:
+				// 1. we're already connecting (in which case, we don't care)
+				// 2. we can't add aAddr to the connecting list
+				// The semantics of this observer don't let us return an error or leave, so
+				// we can't do much about it here. Log it, and the next command will
+				// invoke Connect from a better situation.
+				LOG1(_L("\tFailed to re-connect bearer after connection removed: %d"), err);
+				}
 			}
 		}
 	
-	if (needToReconnect)
+	// Complete the specific request(s) that caused a DisconnectRequest on the 
+	// bearer. Tell all sessions- they remember the address they wanted to 
+	// connect to, and will filter on the address we give them.
+	TInt count = iControllerSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		ASSERT_DEBUG(iBearerManager);
-		TInt err = iBearerManager->Connect(aAddr);
-		if ( err != KErrNone )
-			{
-			// This fails if:
-			// 1. we're already connecting (in which case, we don't care)
-			// 2. we can't add aAddr to the connecting list
-			// The semantics of this observer don't let us return an error or leave, so
-			// we can't do much about it here. Log it, and the next command will
-			// invoke Connect from a better situation.
-			LOG1(_L("\tFailed to re-connect bearer after connection removed: %d"), err);
-			}
+		ASSERT_DEBUG(iControllerSessions[ii]);
+		iControllerSessions[ii]->CompleteDisconnect(aAddr, aError);
 		}
 
 	LOGREMOTES;
@@ -3107,7 +3416,8 @@
 	{
 	LOG_FUNC;
 	LOG1(_L("\taSessionId = %d"), aSessionId);
-	LOGSESSIONS;
+	LOGCONTROLLERSESSIONS;
+	LOGTARGETSESSIONS;
 	LOGCONNECTIONHISTORYANDINTEREST;
 
 	// Update the record for this session.
@@ -3328,70 +3638,92 @@
 	iMessageRecipientsList->RemoveAndDestroyMessage(aTransactionId);
 	}
 
-TClientInfo* CRemConServer::ClientIdToClientInfo(TRemConClientId aId)
+TClientInfo* CRemConServer::TargetClientIdToClientInfo(TRemConClientId aId)
 	{
 	TClientInfo* clientInfo = NULL;
 	
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
+	iTargetClientsLock.Wait();
+	const TUint count = iTargetClients.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		CRemConSession* const sess = iSessions[ii];
-		ASSERT_DEBUG(sess);
-		if (sess->Id() == aId)
+		CRemConTargetClientProcess * const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		if (client->Id() == aId)
 			{
-			clientInfo = &sess->ClientInfo();
+			clientInfo = &client->ClientInfo();
 			break;
 			}
 		}
-	iSessionsLock.Signal();
+	iTargetClientsLock.Signal();
 	
 	return clientInfo;
 	}
 
 TInt CRemConServer::SupportedInterfaces(const TRemConClientId& aId, RArray<TUid>& aUids)
 	{
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
+	TUint count = iControllerSessions.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		CRemConSession* const sess = iSessions[ii];
+		CRemConSession* const sess = iControllerSessions[ii];
 		ASSERT_DEBUG(sess);
 		if (sess->Id() == aId)
 			{
-			iSessionsLock.Signal();
 			return sess->SupportedInterfaces(aUids);
 			}
 		}
-	iSessionsLock.Signal();
+	
+	iTargetClientsLock.Wait();
+	count = iTargetClients.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		if (client->Id() == aId)
+			{
+			iTargetClientsLock.Signal();
+			return client->SupportedInterfaces(aUids);
+			}
+		}
+	iTargetClientsLock.Signal();
 	
 	return KErrNotFound;
 	}
 
 TInt CRemConServer::SupportedOperations(const TRemConClientId& aId, TUid aInterfaceUid, RArray<TUint>& aOperations)
 	{
-	iSessionsLock.Wait();
-	const TUint count = iSessions.Count();
+	iTargetClientsLock.Wait();
+	TUint count = iTargetClients.Count();
 	for ( TUint ii = 0 ; ii < count ; ++ii )
 		{
-		CRemConSession* const sess = iSessions[ii];
+		CRemConTargetClientProcess* const client = iTargetClients[ii];
+		ASSERT_DEBUG(client);
+		if (client->Id() == aId)
+			{
+			iTargetClientsLock.Signal();
+			return client->SupportedOperations(aInterfaceUid, aOperations);
+			}
+		}
+	iTargetClientsLock.Signal();
+
+	count = iControllerSessions.Count();
+	for ( TUint ii = 0 ; ii < count ; ++ii )
+		{
+		CRemConControllerSession* const sess = iControllerSessions[ii];
 		ASSERT_DEBUG(sess);
 		if (sess->Id() == aId)
 			{
-			iSessionsLock.Signal();
 			return sess->SupportedOperations(aInterfaceUid, aOperations);
 			}
 		}
-	iSessionsLock.Signal();
 	
 	return KErrNotFound;
 	}
 
 void CRemConServer::SetRemoteAddressedClient(const TUid& aBearerUid, const TRemConClientId& aId)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	
-	TClientInfo* clientInfo = ClientIdToClientInfo(aId);
+	TClientInfo* clientInfo = TargetClientIdToClientInfo(aId);
 	// Bearer must supply valid client id
 	ASSERT_DEBUG(clientInfo);
 
@@ -3411,30 +3743,30 @@
 
 TRemConClientId CRemConServer::ClientIdByProcessId(TProcessId aProcessId)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	TRemConClientId ret = KNullClientId;
-	iSessionsLock.Wait();
-	CRemConSession* session = TargetSession(aProcessId);
-	if(session)
+	iTargetClientsLock.Wait();
+	CRemConTargetClientProcess* client = TargetClient(aProcessId);
+	if(client)
 		{
-		ret = session->Id();
+		ret = client->Id();
 		}
-	iSessionsLock.Signal();
+	iTargetClientsLock.Signal();
 	return ret;
 	}
 
 void CRemConServer::BulkInterfacesForClientL(TRemConClientId aId, RArray<TUid>& aUids)
 	{
-	LOG_FUNC
-	iSessionsLock.Wait();
-	CleanupSignalPushL(iSessionsLock);
-	CRemConSession* session = Session(aId);
-	if(!session)
+	LOG_FUNC;
+	iTargetClientsLock.Wait();
+	CleanupSignalPushL(iTargetClientsLock);
+	CRemConTargetClientProcess* client = TargetClient(aId);
+	if(!client)
 		{
 		LEAVEL(KErrNotFound);
 		}
-	LEAVEIFERRORL(session->SupportedBulkInterfaces(aUids));
-	CleanupStack::PopAndDestroy(&iSessionsLock);
+	LEAVEIFERRORL(client->SupportedBulkInterfaces(aUids));
+	CleanupStack::PopAndDestroy(&iTargetClientsLock);
 	}
 
 
@@ -3481,7 +3813,7 @@
 	// Thread is dead so kill handle.
 	iServer.iBulkServerThread.Close();
 	iServer.iBulkThreadOpen = EFalse;
-	iServer.StartShutdownTimerIfNoSessionsOrBulkThread();
+	iServer.StartShutdownTimerIfNoClientsOrBulkThread();
 	iServer.iBulkThreadWatcher = NULL;
 	delete this; // end...
 	}
--- a/accessoryservices/remotecontrolfw/server/src/session.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/remotecontrolfw/server/src/session.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -30,7 +30,6 @@
 #include "bearermanager.h"
 #include "remconmessage.h"
 #include "connections.h"
-#include "activehelper.h"
 #include "session.h"
 #include "messagequeue.h"
 #include "remconserver.h"
@@ -43,18 +42,6 @@
 PANICCATEGORY("session");
 #endif
 
-CRemConSession* CRemConSession::NewL(CRemConServer& aServer,
-		CBearerManager& aBearerManager,
-		const RMessage2& aMessage,
-		TUint aId)
-	{
-	LOG_STATIC_FUNC
-	CRemConSession* self = new(ELeave) CRemConSession(aServer, aBearerManager, aId);
-	CleanupStack::PushL(self);
-	self->ConstructL(aMessage);
-	CLEANUPSTACK_POP1(self);
-	return self;
-	}
 
 CRemConSession::CRemConSession(CRemConServer& aServer,
 		CBearerManager& aBearerManager,
@@ -63,37 +50,22 @@
 	iBearerManager(aBearerManager),
 	iId(aId)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	}
 
-void CRemConSession::ConstructL(const RMessage2& aMessage)
+void CRemConSession::BaseConstructL(const TClientInfo& aClientInfo)
 	{
 	LOG_FUNC;
 
-	// Get the client's process ID.
-	RThread thread;
-	LEAVEIFERRORL(aMessage.Client(thread));
-	CleanupClosePushL(thread);
-	RProcess process;
-	LEAVEIFERRORL(thread.Process(process));
-	iClientInfo.ProcessId() = process.Id();
-	process.Close();
-	iClientInfo.SecureId() = thread.SecureId();
-	CleanupStack::PopAndDestroy(&thread);
+	iClientInfo = aClientInfo;
 
 	iSendQueue = CMessageQueue::NewL();
-	
+
+	// The send callback is used by the base class to handle queued sends.
+	iSendNextCallBack = new(ELeave) CAsyncCallBack(CActive::EPriorityStandard);
 	TCallBack cb(SendNextCb, this);
-	
-	iSendNextCallBack = new(ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
-	
-	// Tell the server about us.
-	LEAVEIFERRORL(iServer.ClientOpened(*this));
+	iSendNextCallBack->Set(cb);
 
-	// Set our pointer into the connection history at the current/'Last' item.
-	iServer.SetConnectionHistoryPointer(Id());
-	
-	iPendingMsgProcessor = new (ELeave) CActiveHelper(*this);
 	}
 
 CRemConSession::~CRemConSession()
@@ -101,16 +73,9 @@
 	LOG(KNullDesC8);
 	LOG_FUNC;
 	
-	delete iPendingMsgProcessor;
 	delete iSendNextCallBack;
 	delete iSendQueue;
-	// we will need to tell the server which bearer this used to be connected to
-	// this enables the server to not inform a bearer that is already connected
-	// that its been connected
-	// Tell the server we've gone away- it may start its shutdown timer.
-	iServer.ClientClosed(*this, iRemoteAddress.BearerUid());
 	delete iInterestedAPIs;
-	iPlayerName.Close();
 	}
 
 void CRemConSession::ServiceL(const RMessage2& aMessage)
@@ -118,7 +83,6 @@
 	LOG(KNullDesC8);
 	LOG_FUNC;
 	LOG1(_L("\taMessage.Function() = %d"), aMessage.Function());
-
 	// Switch on the IPC number and call a 'message handler'. Message handlers 
 	// complete aMessage (either with Complete or Panic), or make a note of 
 	// the message for later asynchronous completion.
@@ -169,50 +133,18 @@
 		CompleteClient(aMessage, KErrNone);
 		break;
 
-	case ERemConSetClientType:
-		SetClientType(aMessage);
+	case ERemConSetPlayerType:
+		SetPlayerType(aMessage);
 		// This is a sync API- check that the message has been completed.
 		// (NB We don't check the converse for async APIs because the message 
 		// may have been panicked synchronously.)
 		ASSERT_DEBUG(aMessage.IsNull());
 		break;
 
-	case ERemConGoConnectionOriented:
-		GoConnectionOriented(aMessage);
-		ASSERT_DEBUG(aMessage.IsNull());
-		break;
-
-	case ERemConGoConnectionless:
-		GoConnectionless(aMessage);
-		ASSERT_DEBUG(aMessage.IsNull());
-		break;
-
-	case ERemConConnectBearer:
-		ConnectBearer(aMessage);
-		break;
-
-	case ERemConConnectBearerCancel:
-		ConnectBearerCancel(aMessage);
-		ASSERT_DEBUG(aMessage.IsNull());
-		break;
-
-	case ERemConDisconnectBearer:
-		DisconnectBearer(aMessage);
-		break;
-
-	case ERemConDisconnectBearerCancel:
-		DisconnectBearerCancel(aMessage);
-		ASSERT_DEBUG(aMessage.IsNull());
-		break;
-
 	case ERemConSend:
 		Send(aMessage);
 		break;
-		
-	case ERemConSendNotify:
-		SendNotify(aMessage);
-		break;
-		
+				
 	case ERemConSendUnreliable:
 		SendUnreliable(aMessage);
 		break;
@@ -255,6 +187,38 @@
 		ASSERT_DEBUG(aMessage.IsNull());
 		break;
 		
+	case ERemConGoConnectionOriented:
+		GoConnectionOriented(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConGoConnectionless:
+		GoConnectionless(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConConnectBearer:
+		ConnectBearer(aMessage);
+		break;
+
+	case ERemConConnectBearerCancel:
+		ConnectBearerCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+
+	case ERemConDisconnectBearer:
+		DisconnectBearer(aMessage);
+		break;
+
+	case ERemConDisconnectBearerCancel:
+		DisconnectBearerCancel(aMessage);
+		ASSERT_DEBUG(aMessage.IsNull());
+		break;
+		
+	case ERemConSendNotify:
+		SendNotify(aMessage);
+		break;
+		
 	default:
 		// Unknown message
 		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
@@ -273,394 +237,51 @@
 		}
 	}
 
-void CRemConSession::SetClientType(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	if ( iType != ERemConClientTypeUndefined )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeAlreadySet);
-		return;
-		}
-
-	const TRemConClientType type = static_cast<TRemConClientType>(aMessage.Int0());
-	LOG1(_L("\trequested (TRemConClientType) type = %d"), type);
-	
-	TInt err = aMessage.GetDesLength(1);
-	if(err >= 0)
-		{
-		TRAP(err, DoSetClientTypeL(aMessage));
-		if(err == KErrBadDescriptor)
-			{
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-			return;
-			}
-		}
-	else if(err == KErrBadDescriptor)
-		{
-		// The additional parameters are optional (i.e. old or controller clients won't provide them).
-		err = KErrNone;
-		}
-	
-	if(err != KErrNone)
-		{
-		CompleteClient(aMessage, err);
-		}
-	else
-		{
-		switch ( type )
-			{
-		case ERemConClientTypeController:
-			iType = type;
-			CompleteClient(aMessage, KErrNone);
-			break;
-	
-		case ERemConClientTypeTarget:
-			// Check that there aren't already any target clients with the
-			// same process ID.
-			if ( !iServer.TargetClientWithSameProcessId(iClientInfo.ProcessId()) )
-				{
-				iType = type;
-				CompleteClient(aMessage, KErrNone);
-				}
-			else
-				{
-				CompleteClient(aMessage, KErrInUse);
-				}
-			break;
-	
-		default:
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-			break;
-			}
-		}
-
-	if ( iType != ERemConClientTypeUndefined )
-		{
-		// The type got set, so tell the server, so it can tell the bearers if 
-		// necessary. 
-		iServer.ClientTypeSet(*this);
-		}
-	}
-
-void CRemConSession::DoSetClientTypeL(const RMessage2& aMessage)
+void CRemConSession::GetPlayerTypeAndNameL(const RMessage2& aMessage, TPlayerTypeInformation& aPlayerType, RBuf8& aPlayerName)
 	{
-	// Retrieve the client type information 
-	RBuf8 typeBuf;
-	typeBuf.CreateL(sizeof(TPlayerTypeInformation));
-	CleanupClosePushL(typeBuf);
-	aMessage.ReadL(1, typeBuf);
-			
-	const TPlayerTypeInformation* Ptr = reinterpret_cast<const TPlayerTypeInformation*> (typeBuf.Ptr());
-	iPlayerType.iPlayerType = (*Ptr).iPlayerType;
-	iPlayerType.iPlayerSubType = (*Ptr).iPlayerSubType;
-	// Retrieve the client player name inforamtion
-	iPlayerName.CreateL(aMessage.Int2());
-	CleanupClosePushL(iPlayerName);
-	aMessage.ReadL(3, iPlayerName);	
-	CleanupStack::Pop(&iPlayerName);
-	
-	CleanupStack::PopAndDestroy(&typeBuf); 
-	}
-void CRemConSession::GoConnectionOriented(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Check we've had our type set...
-	if ( iType != ERemConClientTypeController )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-		return;
-		}
-
-	if ( !iRemoteAddress.IsNull() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicAlreadyConnectionOriented);
-		return;
-		}
-
-	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() || iSendMsg.Handle())
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-	if (iSending != ENotSending)
-		{
-		DoSendCancel();
-		}
-	EmptySendQueue();
-	
-	// Get the desired address from the message and check it.
-	const TUid uid = TUid::Uid(aMessage.Int0());
-	LOG1(_L("\tuid = 0x%08x"), uid);
-	// Check the requested bearer exists.
-	TBool bearerExists = iBearerManager.BearerExists(uid);
-	if ( !bearerExists)
+	// check validity of descriptors
+	if (aMessage.GetDesLength(1) < 0 || aMessage.GetDesLength(2) < 0)
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerPluginIncorrectInterface);
-		return;
-		}
-	// Check the bearer-specific part of the address.
-	TBuf8<TRemConAddress::KMaxAddrSize> buf;
-	TInt err = aMessage.Read(1, buf);
-	if ( err != KErrNone )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-		return;
-		}
-
-	// Do security check- if this client won't be allowed to use the bearer 
-	// then fail the request. 
-	// NB This security check (repeated in debug at ConnectBearer and 
-	// DisconnectBearer time) is all that stands between a connection-oriented 
-	// client and the bearer, and is all the caps checking that RemCon does!
-	err = KErrPermissionDenied;
-	if ( iBearerManager.CheckPolicy(uid, aMessage) )
-		{
-		err = KErrNone;
-		}
-		
-		
-	// if alls well and we're connection oriented then set up as such
-	if (KErrNone == err)
-		{
-		// The client has passed all our checks- set our data member.
-		iRemoteAddress.BearerUid() = uid;
-		iRemoteAddress.Addr() = buf;
-		// tell the server
-		iServer.ClientGoConnectionOriented(*this,uid);
-		}
-				
-	CompleteClient(aMessage, err);
-	}
-
-void CRemConSession::GoConnectionless(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Check we've had our type set...
-	if ( iType != ERemConClientTypeController )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-		return;
-		}
-
-	if ( iRemoteAddress.IsNull() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
-		return;
+		LEAVEL(KErrBadDescriptor);
 		}
 
-	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() || iSendMsg.Handle())
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-	
-	if (iSending != ENotSending)
+	// Retrieve and validate the client type information 
+	TPckg<TPlayerTypeInformation> pckg(aPlayerType);
+	aMessage.ReadL(1, pckg);
+	switch (aPlayerType.iPlayerType)
 		{
-		DoSendCancel();
-		}
-	EmptySendQueue();
-	
-	// we will need to tell the server which bearer this used to be connected to
-	// this enables the server to not inform a bearer that is already connected
-	// that its been connected
-	TUid oldUid = iRemoteAddress.BearerUid();
-	
-	iRemoteAddress.BearerUid() = KNullUid;	
-
-	// tell the server
-	iServer.ClientGoConnectionless(*this, oldUid);
-
-	CompleteClient(aMessage, KErrNone);
-	}
-
-void CRemConSession::ConnectBearer(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	if ( iType != ERemConClientTypeController )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-		return;
-		}
-
-	if ( iConnectBearerMsg.Handle() || iDisconnectBearerMsg.Handle() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-
-	if ( iRemoteAddress.IsNull() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
-		return;
+	case ERemConAudioPlayer:
+		// Valid
+	case ERemConVideoPlayer:
+		// Valid
+	case ERemConBroadcastingAudioPlayer:
+		// Valid
+	case ERemConBroadcastingVideoPlayer:
+		// Valid
+		break;
+	default:
+		// Invalid
+		LEAVEL(KErrArgument);
 		}
-
-	// Check the requested bearer exists.
-	TBool bearerExists = iBearerManager.BearerExists(iRemoteAddress.BearerUid());
-	// This check was done at GoConnectionOriented time.
-	ASSERT_DEBUG(bearerExists);
-	// So was this one.
-	ASSERT_DEBUG(iBearerManager.CheckPolicy(iRemoteAddress.BearerUid(), aMessage));
-
-	// Check the state of our given connection at the bearer level. If it is: 
-	// -) disconnected request the connection to come up,
-	// -) connecting or disconnecting, add message to the queue of pending 
-	//		messages, and process it once connecting/disconnecting has been completed
-	// -) connected, complete the client's message,
-
-	TConnectionState conState;
-	conState = iServer.ConnectionState(iRemoteAddress);
-
-	if ( conState == EDisconnected )
+	switch (aPlayerType.iPlayerSubType)
 		{
-		// The bearer may indicate connection synchronously, so set this 
-		// message _before_ we ask them
-		iConnectBearerMsg = aMessage;
-		TInt err = iBearerManager.Connect(iRemoteAddress);
-		if ( err != KErrNone )
-			{
-			CompleteClient(iConnectBearerMsg, err);
-			}
-		}
-	else if ( conState == EDisconnecting ||  conState == EConnecting )
-		{
-		if ( iPendingMsg.Handle() )
-			{
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-			return;
-			}
-		// Store the message, it will get processed later.
-		iPendingMsg = aMessage;
-		}
-	else // EConnected
-		{
-		CompleteClient(aMessage, KErrNone);
-		}
-		
-	}
-
-void CRemConSession::ConnectBearerCancel(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Check we've had our type set...
-	if ( iType != ERemConClientTypeController )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-		return;
+	case ERemConNoSubType:
+		// Valid
+	case ERemConAudioBook:
+		// Valid
+	case ERemConPodcast:
+		// Valid
+		break;
+	default:
+		// Invalid
+		LEAVEL(KErrArgument);
 		}
 
-	if ( iConnectBearerMsg.Handle() )
-		{
-		CompleteClient(iConnectBearerMsg, KErrCancel);
-		}
-	else if ( iPendingMsg.Handle() && ( iPendingMsg.Function() == ERemConConnectBearer ))
-		{
-		CompleteClient(iPendingMsg, KErrCancel);
-		}
-		
-	CompleteClient(aMessage, KErrNone);
-	// At no point do we make any change to the processes going on underneath
-	// us- 'Cancel' APIs are just for cancelling interest in an async
-	// operation.
-	}
-
-void CRemConSession::DisconnectBearer(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	if ( iType != ERemConClientTypeController )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-		return;
-		}
-
-	if ( iDisconnectBearerMsg.Handle() || iConnectBearerMsg.Handle() || iSendMsg.Handle())
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-
-	if ( iRemoteAddress.IsNull() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicNotConnectionOriented);
-		return;
-		}
-
-	if (iSending != ENotSending)
-		{
-		DoSendCancel();
-		}
-	EmptySendQueue();
-	
-	// Check the requested bearer exists.
-	TBool bearerExists = iBearerManager.BearerExists(iRemoteAddress.BearerUid());
-	// This check was done at GoConnectionOriented time.
-	ASSERT_DEBUG(bearerExists);
-	// So was this one.
-	ASSERT_DEBUG(iBearerManager.CheckPolicy(iRemoteAddress.BearerUid(), aMessage));
-
-	// Check the state of the given connection. If it is:
-	// -) connected, request connection to go away,
-	// -) disconnected, compete the client's message,
-	// -) connecting or disconnecting, add message to the queue of pending 
-	//		messages, and process it once connecting/disconnecting has been completed
-
-	TInt err;
-	TConnectionState conState;
-	conState = iServer.ConnectionState(iRemoteAddress);
-
-	if ( conState == EConnected )
-		{
-		// The bearer may indicate disconnection synchronously, so set this 
-		// message _before_ we ask them
-		iDisconnectBearerMsg = aMessage;
-		err = iBearerManager.Disconnect(iRemoteAddress);
-		if ( err != KErrNone )
-			{
-			CompleteClient(iDisconnectBearerMsg, err);
-			}
-		}
-	else if ( conState == EDisconnecting ||  conState == EConnecting )
-		{
-		if ( iPendingMsg.Handle() )
-			{
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-			return;
-			}
-		// Store the message, it will get processed later.
-		iPendingMsg = aMessage;
-		}
-	else //disconnected
-		{
-		CompleteClient(aMessage, KErrNone);	
-		}
-	}
-
-void CRemConSession::DisconnectBearerCancel(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Check we've had our type set...
-	if ( iType != ERemConClientTypeController )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
-		return;
-		}
-
-	if ( iDisconnectBearerMsg.Handle() )
-		{
-		CompleteClient(iDisconnectBearerMsg, KErrCancel);
-		}
-	else if ( iPendingMsg.Handle() && (iPendingMsg.Function() == ERemConDisconnectBearer ))
-		{
-		CompleteClient(iPendingMsg, KErrCancel);
-		}
-		
-	CompleteClient(aMessage, KErrNone);
+	// Retrieve the client player name inforamtion
+	aPlayerName.CreateL(aMessage.GetDesLengthL(2));
+	CleanupClosePushL(aPlayerName);
+	aMessage.ReadL(2, aPlayerName);	
+	CleanupStack::Pop(&aPlayerName);
 	}
 
 void CRemConSession::Send(const RMessage2& aMessage)
@@ -676,529 +297,50 @@
 	
 	iSendMsg = aMessage;
 	
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
-		return;
-		}
-
-	// Check we don't have a disconnect outstanding- this makes no sense from 
-	// a client viewpoint (they should cancel the disconnect first).
-	// [The client is allowed to have a connect request outstanding- the 
-	// bearer manager makes sure a bearer-level connect is not posted on the 
-	// same address twice.]
-	if ( iDisconnectBearerMsg.Handle() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-
-	TRAPD(err, DoSendL(aMessage));
-	if ( err != KErrNone )
-		{
-		CompleteClient(aMessage, err);
-		}
-	}
-
-/**
-Sends a notify message to the remote device.
-
-This function is intended for the RemCon controller client to send a notify
-command to the remote device.
-*/
-void CRemConSession::SendNotify(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Check we're not already sending...
-	if ( iSendMsg.Handle())
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicSendAlreadyOutstanding);
-		return;
-		}
-	
-	iSendMsg = aMessage;
-	
-	// Check we've had our type set...
-	if (Type() != ERemConClientTypeController)
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
-		return;
-		}
-
-	// Check we don't have a disconnect outstanding- this makes no sense from 
-	// a client viewpoint (they should cancel the disconnect first).
-	// [The client is allowed to have a connect request outstanding- the 
-	// bearer manager makes sure a bearer-level connect is not posted on the 
-	// same address twice.]
-	if ( iDisconnectBearerMsg.Handle() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-
-	TRAPD(err, DoSendNotifyL(aMessage));
-	if ( err != KErrNone )
-		{
-		CompleteClient(aMessage, err);
-		}
-	}
-
-void CRemConSession::DoSendL(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Get the data the client wants to send.
-	const TUid interfaceUid = TUid::Uid(aMessage.Int0());
-	LOG1(_L("\tinterfaceUid = 0x%08x"), interfaceUid);
-
-	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-		return;
-		}
-
-	TPckgBuf<TOperationInformation> opInfoPckg;
-	
-	TInt err= aMessage.Read(
-			1, // location of the descriptor in the client's message (as we expect them to have set it up)
-			opInfoPckg, // descriptor to write to from client memory space
-			0 // offset into our descriptor to put the client's data
-			);
-	
-	if ( err != KErrNone )
-		{
-		LOG1(_L("\taMessage.Read = %d"), err);
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-		return;
-		}	
-	
-	const TUint operationId = opInfoPckg().iOperationId;
-	LOG1(_L("\toperationId = 0x%02x"), operationId);
-	
-	const TRemConMessageSubType messageSubType = opInfoPckg().iMessageSubType;
-	LOG1(_L("\tmessageSubType = 0x%02x"), messageSubType);
-
-	
-	const TUint dataLength = (TUint)aMessage.GetDesLengthL(3);
-	LOG1(_L("\tdataLength = %d"), dataLength);
-	
-	// If the client wanted to send some operation-associated data, read it 
-	// from them.
-	RBuf8 sendDes;
-	if ( dataLength != 0 )
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		sendDes.CreateL(dataLength);
-		TInt err = aMessage.Read(
-			3, // location of the descriptor in the client's message (as we expect them to have set it up)
-			sendDes, // descriptor to write to from client memory space
-			0 // offset into our descriptor to put the client's data
-			);
-		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
-		// descriptor is a panicking offence for them, not an 'error the 
-		// request' offence.
-		if ( err != KErrNone )
-			{
-			LOG1(_L("\taMessage.Read = %d"), err);
-			sendDes.Close();
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-			return;
-			}
-		}
-	CleanupClosePushL(sendDes);
-
-	// Before we ask the server to send, we must set our ClientInfo 
-	// correctly so the TSP can get information about the client. 
-	iClientInfo.Message() = aMessage;
-
-	CRemConMessage* msg = NULL;
-	
-	// Examine the session type.
-	switch ( iType )
-		{
-	case ERemConClientTypeTarget:
-		{
-		LOG(_L("\tTARGET send"));
-
-		msg = CRemConMessage::NewL(
-			TRemConAddress(), // we don't know which remotes it's going to yet
-			ERemConResponse, // targets can only send responses
-			messageSubType,
-			interfaceUid,
-			operationId,
-			sendDes, // msg takes ownership
-			Id(), // session id to match this response against the originating command
-			0, // transaction id not yet known
-			ETrue);
-		CLEANUPSTACK_POP1(&sendDes); // now owned by msg
-		
-		}
-		break;
-
-	case ERemConClientTypeController:
-		{
-		LOG(_L("\tCONTROLLER send"));
-        if (  (messageSubType == ERemConNotifyCommandAwaitingInterim)
-           || (messageSubType == ERemConNotifyCommandAwaitingChanged)
-            )
-        	{
-        	LOG(_L("\terror, not allowed to use Send() to send notify command"));
-        	CleanupStack::PopAndDestroy(&sendDes);
-        	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
-        	return;
-        	}
-        else
-        	{
-        	msg = CRemConMessage::NewL(
-        			iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
-        			ERemConCommand, 
-        			messageSubType,
-        			interfaceUid,
-        			operationId,
-        			sendDes, // msg takes ownership
-        			Id(), // session id for when the response comes back
-        			0, // we let the bearer manager invent a new transaction id when the message gets to it
-        			ETrue);
-        	}		
-		CLEANUPSTACK_POP1(&sendDes); // now owned by msg
-
-		}
-		break;
-
-	default:
-		DEBUG_PANIC_LINENUM;
-		break;
-		}
-	
-	ASSERT_DEBUG(iSendQueue);
-	// We know msg is valid at this stage as the code would leave or panic earlier if msg was 
-	// not set.
-	ASSERT_DEBUG(msg);
-	
-	if (iSending != ENotSending || !iSendQueue->IsEmpty())
-		{
-		iSendQueue->Append(*msg);
-		}
-	else
-		{
-		// we know msg cannot be null here as said above.
-		SendToServer(*msg);
-		}
-	}
-
-/**
-@see CRemConSession::SendNotify
-*/
-void CRemConSession::DoSendNotifyL(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Get the data the client wants to send.
-	const TUid interfaceUid = TUid::Uid(aMessage.Int0());
-	LOG1(_L("\tinterfaceUid = 0x%08x"), interfaceUid);
-
-	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
-	TPckgBuf<TOperationInformation> opInfoPckg;	
-	TInt err= aMessage.Read(
-			1, // location of the descriptor in the client's message (as we expect them to have set it up)
-			opInfoPckg, // descriptor to write to from client memory space
-			0 // offset into our descriptor to put the client's data
-			);
-	
-	if ( err != KErrNone )
-		{
-		LOG1(_L("\taMessage.Read = %d"), err);
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-		return;
-		}	
-	
-	const TUint operationId = opInfoPckg().iOperationId;
-	LOG1(_L("\toperationId = 0x%02x"), operationId);
-	
-	const TRemConMessageSubType messageSubType = opInfoPckg().iMessageSubType;
-	LOG1(_L("\tmessageSubType = 0x%02x"), messageSubType);
-	
-	const TUint dataLength = (TUint)aMessage.GetDesLengthL(2);
-	LOG1(_L("\tdataLength = %d"), dataLength);
-	
-	// If the client wanted to send some operation-associated data, read it 
-	// from them.
-	RBuf8 sendDes;
-	if ( dataLength != 0 )
-		{
-		sendDes.CreateL(dataLength);
-		TInt err = aMessage.Read(
-			2, // location of the descriptor in the client's message (as we expect them to have set it up)
-			sendDes, // descriptor to write to from client memory space
-			0 // offset into our descriptor to put the client's data
-			);
-		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
-		// descriptor is a panicking offence for them, not an 'error the 
-		// request' offence.
-		if ( err != KErrNone )
-			{
-			LOG1(_L("\taMessage.Read = %d"), err);
-			sendDes.Close();
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-			return;
-			}
-		}
-
 	// Before we ask the server to send, we must set our ClientInfo 
 	// correctly so the TSP can get information about the client. 
 	iClientInfo.Message() = aMessage;
 
+	// Prepare the message for send. If DoPrepareSendMessageL() returns
+	// NULL, it panicked the client.
 	CRemConMessage* msg = NULL;
-	
-	if (messageSubType != ERemConNotifyCommandAwaitingInterim)
-		{
-		sendDes.Close();
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
-		return;
-		}
-	
-	CleanupClosePushL(sendDes);
-	msg = CRemConMessage::NewL(
-			iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
-			ERemConNotifyCommand, 
-			messageSubType,
-			interfaceUid,
-			operationId,
-			sendDes, // msg takes ownership
-			Id(), // session id for when the response comes back
-			0, // we let the bearer manager invent a new transaction id when the message gets to it
-			ETrue);	
-	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
-	
-	LOG(_L("\tCONTROLLER send"));
-	ASSERT_DEBUG(iSendQueue);
-	if (iSending != ENotSending || !iSendQueue->IsEmpty())
-		{
-		iSendQueue->Append(*msg);
-		}
-	else
+	TRAPD(err, msg = DoPrepareSendMessageL(aMessage));
+
+	if ( err != KErrNone )
 		{
-		SendToServer(*msg);
-		}
-	}
-
-void CRemConSession::SendUnreliable(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
-		return;
+		CompleteClient(aMessage, err);
 		}
-
-	// Check we don't have a disconnect outstanding- this makes no sense from 
-	// a client viewpoint (they should cancel the disconnect first).
-	// [The client is allowed to have a connect request outstanding- the 
-	// bearer manager makes sure a bearer-level connect is not posted on the 
-	// same address twice.]
-	if ( iDisconnectBearerMsg.Handle() )
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBearerControlOutstanding);
-		return;
-		}
-
-	CRemConMessage* msg = NULL;
-	TRAPD(err, msg = DoCreateUnreliableMessageL(aMessage));
-	CompleteClient(aMessage, err);
-	if (err == KErrNone)
+	else if (msg)
 		{
 		ASSERT_DEBUG(iSendQueue);
-		if (iSending || !iSendQueue->IsEmpty())
+	
+		if (iSending != ENotSending || !iSendQueue->IsEmpty())
 			{
 			iSendQueue->Append(*msg);
 			}
 		else
 			{
+			// we know msg cannot be null here as said above.
 			SendToServer(*msg);
 			}
 		}
 	}
 
-CRemConMessage* CRemConSession::DoCreateUnreliableMessageL(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
-
-	// Get the data the client wants to send.
-	const TUid interfaceUid = TUid::Uid(aMessage.Int0());
-	LOG1(_L("\tinterfaceUid = 0x%08x"), interfaceUid);
-
-	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-		LEAVEL(KErrBadDescriptor);
-		}
-
-	TPckgBuf<TOperationInformation> opInfoPckg;
-	
-	TInt err= aMessage.Read(
-			1, // location of the descriptor in the client's message (as we expect them to have set it up)
-			opInfoPckg, // descriptor to write to from client memory space
-			0 // offset into our descriptor to put the client's data
-			);
-	
-	if ( err != KErrNone )
-		{
-		LOG1(_L("\taMessage.Read = %d"), err);
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-		LEAVEL(KErrBadDescriptor);
-		}	
-	
-	const TUint operationId = opInfoPckg().iOperationId;
-	LOG1(_L("\toperationId = 0x%02x"), operationId);
-	
-	const TRemConMessageSubType messageSubType = opInfoPckg().iMessageSubType;
-	LOG1(_L("\tmessageSubType = 0x%02x"), messageSubType);
-
-	
-	const TUint dataLength = (TUint)aMessage.GetDesLengthL(2);
-	LOG1(_L("\tdataLength = %d"), dataLength);
-	
-	// If the client wanted to send some operation-associated data, read it 
-	// from them.
-	RBuf8 sendDes;
-	if ( dataLength != 0 )
-		{
-		sendDes.CreateL(dataLength);
-		TInt err = aMessage.Read(
-			2, // location of the descriptor in the client's message (as we expect them to have set it up)
-			sendDes, // descriptor to write to from client memory space
-			0 // offset into our descriptor to put the client's data
-			);
-		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
-		// descriptor is a panicking offence for them, not an 'error the 
-		// request' offence.
-		if ( err != KErrNone )
-			{
-			LOG1(_L("\taMessage.Read = %d"), err);
-			sendDes.Close();
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
-			LEAVEL(KErrBadDescriptor);
-			}
-		}
-	CleanupClosePushL(sendDes);
-
-	// Before we ask the server to send, we must set our ClientInfo 
-	// correctly so the TSP can get information about the client. 
-	iClientInfo.Message() = aMessage;
-
-	CRemConMessage* msg = NULL;
-	
-	// Examine the session type.
-	switch ( iType )
-		{
-	case ERemConClientTypeTarget:
-		{
-		LOG(_L("\tTARGET send"));
-
-		msg = CRemConMessage::NewL(
-			TRemConAddress(), // we don't know which remotes it's going to yet
-			ERemConResponse, // targets can only send responses
-			messageSubType,
-			interfaceUid,
-			operationId,
-			sendDes, // msg takes ownership
-			Id(), // session id to match this response against the originating command
-			0, // transaction id not yet known
-			EFalse);
-		CLEANUPSTACK_POP1(&sendDes); // now owned by msg
-		break;
-		}
-
-	case ERemConClientTypeController:
-		{
-		LOG(_L("\tCONTROLLER send"));
-		
-		// A client is not allowed to send an unreliable notify command.
-		if	(	(messageSubType == ERemConNotifyCommandAwaitingInterim)
-			||	(messageSubType == ERemConNotifyCommandAwaitingChanged)
-			)
-			{
-			LOG(_L8("\tNot allowed to send unreliable notify command"));
-			CleanupStack::PopAndDestroy(&sendDes);
-			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
-			LEAVEL(KErrBadDescriptor);
-			}
-		
-		msg = CRemConMessage::NewL(
-			iRemoteAddress, // either specified (if we're connection-oriented) or null (we're connectionless- this field will be filled in by the TSP)
-			ERemConCommand, // controllers can only send commands
-			messageSubType,
-			interfaceUid,
-			operationId,
-			sendDes, // msg takes ownership
-			Id(), // session id for when the response comes back
-			0, // we let the bearer manager invent a new transaction id when the message gets to it
-			EFalse);
-		CLEANUPSTACK_POP1(&sendDes); // now owned by msg
-		
-		}
-		break;
-
-	default:
-		DEBUG_PANIC_LINENUM;
-		break;
-		}
-
-	return msg;
-	}
-
-void CRemConSession::SendToServer(CRemConMessage& aMsg)
-	{
-	LOG_FUNC;
-	
-	// Set our completion members.
-	NumRemotes() = 0;
-	NumRemotesToTry() = 0;
-	SendError() = KErrNone;
-
-	
-	iSending = (aMsg.IsReliableSend()) ? ESendingReliable: ESendingUnreliable;
-	switch ( iType )
-		{
-	case ERemConClientTypeTarget:
-		{
-		iServer.SendResponse(aMsg, *this);
-		break;
-		}
-	case ERemConClientTypeController:
-		{
-		iServer.SendCommand(aMsg);
-		break;
-		}
-	default:
-		DEBUG_PANIC_LINENUM;
-		break;
-		}
-	}
-
-
 void CRemConSession::SendCancel(const RMessage2& aMessage)
 	{
 	LOG_FUNC;
 
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
@@ -1234,45 +376,6 @@
 	CompleteClient(aMessage, KErrNone);
 	}
 
-void CRemConSession::DoSendCancel()
-	{
-	LOG_FUNC;
-	// We must tell the server, and pull the CRemConMessage from the 
-	// 'outgoing pending TSP' queue if it's on it. If the TSP is currently 
-	// processing the CRemConMessage, we must tell it to stop before we 
-	// can complete the RMessage2 iSendMsg- the TSP might still be 
-	// dereferencing bits of it. (The TSP is given iSendMsg so it can 
-	// access the client's secure ID and do a capability check.)
-	// NB This only matters for commands- responses don't go through the 
-	// TSP.
-	// Not also that this processing *stops* this 
-	// CRemConSession::SendCancel method from being the very simple 'I'm 
-	// no longer interested in the completion of the asynchronous request' 
-	// type of API it (and all cancels) should be. It actually does work 
-	// as well. As long as this work is implemented _synchronously_, we 
-	// should be OK.
-	iServer.SendCancel(*this);
-
-	NumRemotesToTry() = 0;
-	iSendError = KErrCancel;
-	CompleteSend();
-	
-	}
-
-void CRemConSession::EmptySendQueue()
-	{
-	ASSERT_DEBUG(!iSendMsg.Handle())
-	ASSERT_DEBUG(iSendNextCallBack);
-	iSendNextCallBack->Cancel();
-	CRemConMessage* msg;
-	ASSERT_DEBUG(iSendQueue);
-	TSglQueIter<CRemConMessage>& iter = iSendQueue->SetToFirst();
-	while ((msg = iter++) != NULL)
-		{
-		iSendQueue->RemoveAndDestroy(*msg);
-		}
-	}
-
 void CRemConSession::Receive(const RMessage2& aMessage)
 	{
 	LOG_FUNC;
@@ -1288,31 +391,26 @@
 		return;
 		}
 
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
 	iReceiveMsg = aMessage;
-	// If there's anything waiting to be given to us, ReceiveRequest will call 
-	// back to us with it.
-	iServer.ReceiveRequest(*this);
+
+	DoReceive();
 	}
 
 void CRemConSession::ReceiveCancel(const RMessage2& aMessage)
 	{
 	LOG_FUNC;
 
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
@@ -1328,12 +426,10 @@
 	{
 	LOG_FUNC;
 
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
@@ -1359,12 +455,10 @@
 	{
 	LOG_FUNC;
 
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
@@ -1414,12 +508,10 @@
 
 	// Messages are pushed to us from bearers, so we don't need anything more 
 	// than some sanity checking here.
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
@@ -1446,12 +538,10 @@
 	{
 	LOG_FUNC;
 
-	// Check we've had our type set...
-	if (	Type() != ERemConClientTypeController
-		&&	Type() != ERemConClientTypeTarget
-		)
+	// Check we've had our features set...
+	if (!ClientAvailable())
 		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientTypeNotSet);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
 		return;
 		}
 
@@ -1463,44 +553,11 @@
 	CompleteClient(aMessage, KErrNone);
 	}
 
-void CRemConSession::RegisterInterestedAPIs(const RMessage2& aMessage)
+CRemConInterfaceDetailsArray* CRemConSession::ExtractInterestedAPIsL(const RMessage2& aMessage)
 	{
 	LOG_FUNC;
 	
-	if(iType == ERemConClientTypeUndefined)
-		{
-		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicRegisterInterestedAPIsInNonTargetSession);
-		}
-	
-	TRAPD(err, DoRegisterInterestedAPIsL(aMessage));
-	
-	if(iType == ERemConClientTypeController)
-		{
-		iServer.ControllerClientAvailable();
-		}
-	else if(err == KErrNone) // must be target
-		{
-		iServer.TargetClientAvailable(*this);
-		
-		TInt count = iInterestedAPIs->Array().Count();
-		for(TInt ix=0; ix<count; ++ix)
-			{
-			CRemConInterfaceDetails* details = iInterestedAPIs->Array()[ix];
-			ASSERT_DEBUG(details);
-			if(details->IsBulk())
-				{
-				iServer.BulkServerRequired();
-				break;
-				}
-			}
-		}
-	
-	CompleteClient(aMessage, err);
-	}
-
-void CRemConSession::DoRegisterInterestedAPIsL(const RMessage2& aMessage)
-	{
-	LOG_FUNC;
+	CRemConInterfaceDetailsArray* result;
 	
 	RBuf8 buf;
 	buf.CreateL(aMessage.GetDesLengthL(0));
@@ -1509,61 +566,112 @@
 	aMessage.ReadL(0, buf);
 	RDesReadStream ipcStream(buf);
 	
-	iInterestedAPIs = CRemConInterfaceDetailsArray::InternalizeL(ipcStream);
+	result = CRemConInterfaceDetailsArray::InternalizeL(ipcStream);
 	
 	ipcStream.Close(); 
-	CleanupStack::PopAndDestroy(&buf); 
+	CleanupStack::PopAndDestroy(&buf);
+	
+	return result;
 	}
 
-void CRemConSession::CompleteConnect(const TRemConAddress& aAddr, TInt aError)
+TBool CRemConSession::DoGetSendInfoLC(const RMessage2& aMessage, 
+		TUid& aInterfaceUid,
+		TUint& aOperationId,
+		TRemConMessageSubType& aMessageSubType,
+		RBuf8& aSendDes)
 	{
-	LOG_FUNC;
-	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+	// Get the data the client wants to send.
+	aInterfaceUid = TUid::Uid(aMessage.Int0());
+	LOG1(_L("\taInterfaceUid = 0x%08x"), aInterfaceUid);
 
-	LOG1(_L("\tiRemoteAddress.BearerUid = 0x%08x"), iRemoteAddress.BearerUid());
-	LOG1(_L("\tiConnectBearerMsg.Handle = %d"), iConnectBearerMsg.Handle());
+	if (aMessage.GetDesLengthL(1) != sizeof(TOperationInformation))
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return EFalse;
+		}
 
-	if ( iRemoteAddress == aAddr )
+	TPckgBuf<TOperationInformation> opInfoPckg;
+	
+	TInt err= aMessage.Read(
+			1, // location of the descriptor in the client's message (as we expect them to have set it up)
+			opInfoPckg, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+	
+	if ( err != KErrNone )
 		{
-		if ( iConnectBearerMsg.Handle() )
+		LOG1(_L("\taMessage.Read = %d"), err);
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+		return EFalse;
+		}	
+	
+	aOperationId = opInfoPckg().iOperationId;
+	LOG1(_L("\taOperationId = 0x%02x"), aOperationId);
+	
+	aMessageSubType = opInfoPckg().iMessageSubType;
+	LOG1(_L("\taMessageSubType = 0x%02x"), aMessageSubType);
+
+	const TUint dataLength = (TUint)aMessage.GetDesLengthL(3);
+	LOG1(_L("\tdataLength = %d"), dataLength);
+	
+	// If the client wanted to send some operation-associated data, read it 
+	// from them.
+	if ( dataLength != 0 )
+		{
+		aSendDes.CreateL(dataLength);
+		TInt err = aMessage.Read(
+			3, // location of the descriptor in the client's message (as we expect them to have set it up)
+			aSendDes, // descriptor to write to from client memory space
+			0 // offset into our descriptor to put the client's data
+			);
+		// NB We don't do LEAVEIFERRORL(aMessage.Read) because a bad client 
+		// descriptor is a panicking offence for them, not an 'error the 
+		// request' offence.
+		if ( err != KErrNone )
 			{
-			// We are a session that has an outstanding request on this specific 
-			// connection address.
-			CompleteClient(iConnectBearerMsg, aError);
-			}
-		else 
-			{
-			// Connect bearer message is not valid. 
-			// Check for pending messages.
-			CheckForPendingMsg();
+			LOG1(_L("\taMessage.Read = %d"), err);
+			aSendDes.Close();
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			return EFalse;
 			}
 		}
+	CleanupClosePushL(aSendDes);
+	return ETrue;
 	}
 
-void CRemConSession::CompleteDisconnect(const TRemConAddress& aAddr, TInt aError)
+void CRemConSession::GoConnectionOriented(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::GoConnectionless(const RMessage2& aMessage)
 	{
-	LOG_FUNC;
-	LOG2(_L("\taError = %d, aAddr.BearerUid = 0x%08x"), aError, aAddr.BearerUid());
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
 
-	LOG1(_L("\tiRemoteAddress.BearerUid = 0x%08x"), iRemoteAddress.BearerUid());
-	LOG1(_L("\tiDisconnectBearerMsg.Handle = %d"), iDisconnectBearerMsg.Handle());
+void CRemConSession::ConnectBearer(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
 
-	if ( iRemoteAddress == aAddr )
-		{
-		if ( iDisconnectBearerMsg.Handle() )
-			{
-			// We are a session that has an outstanding request on this specific 
-			// connection address.
-			CompleteClient(iDisconnectBearerMsg, aError);
-			}
-		else 
-			{
-			// Diconnect bearer message is not valid. 
-			// Check for pending messages.
-			CheckForPendingMsg();
-			}
+void CRemConSession::ConnectBearerCancel(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
 
-		}
+void CRemConSession::DisconnectBearer(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::DisconnectBearerCancel(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
+	}
+
+void CRemConSession::SendNotify(const RMessage2& aMessage)
+	{
+	PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadType);
 	}
 
 void CRemConSession::ConnectionsChanged()
@@ -1586,8 +694,6 @@
 	LOG2(_L("\tiNumRemotes = %d, iSendError = %d"), iNumRemotes, iSendError);
 
 	ASSERT_DEBUG(NumRemotesToTry() == 0);
-	NumRemotesToTry() = -1;
-
 	
 	if (iSending == ESendingReliable)
 		{
@@ -1619,7 +725,7 @@
 		{
 		CompleteClient(iSendMsg, iSendError);
 		}
-	
+
 	ASSERT_DEBUG(iSendQueue);
 	if (!iSendQueue->IsEmpty())
 		{
@@ -1629,20 +735,6 @@
 	iSending = ENotSending;
 	}
 
-TInt CRemConSession::SendNextCb(TAny* aThis)
-	{
-	static_cast<CRemConSession*>(aThis)->DoSendNext();
-	return KErrNone;
-	}
-
-void CRemConSession::DoSendNext()
-	{
-	ASSERT_DEBUG(iSendQueue);
-	CRemConMessage& msg = iSendQueue->First();
-	iSendQueue->Remove(msg);
-	SendToServer(msg);
-	}
-
 void CRemConSession::PanicSend(TRemConClientPanic aCode)
 	{
 	LOG_FUNC;
@@ -1651,12 +743,6 @@
 	PANIC_MSG(iSendMsg, KRemConClientPanicCat, aCode);
 	}
 
-TBool CRemConSession::SupportedMessage(const CRemConMessage& aMsg)
-    {
-    // Return true unless this is a command for an unsupported interface
-    return !(aMsg.MsgType() == ERemConCommand && !FindInterfaceByUid(aMsg.InterfaceUid()));
-    }
-
 TInt CRemConSession::WriteMessageToClient(const CRemConMessage& aMsg)
 	{
 	LOG_FUNC;
@@ -1701,54 +787,21 @@
 	// the client instead.
 	LEAVEIFERRORL(iReceiveMsg.Write(1, aMsg.OperationData()));
 	}
-	
-void CRemConSession::CheckForPendingMsg() const
-	{
-	LOG_FUNC;
-	if (iPendingMsg.Handle())
-		{
-		ASSERT_DEBUG(iPendingMsgProcessor);
-		iPendingMsgProcessor->Complete();
-		}
-	}
-
-void CRemConSession::ProcessPendingMsgL()
-	{
-	LOG_FUNC;
-	if (!iPendingMsg.Handle())
-		{
-		// This means that the pending connect or disconnect message,
-		// has been cancelled by the time we got here.
-		// (It was cancelled between two following calls:
-		// iPendingMsgProcessor::Complete and iPendingMsgProcessor::RunL
-		return;
-		}
-		
-	ServiceL(iPendingMsg);
-	if (iPendingMsg.Handle())
-		{
-		// This means that the pending msg has not been completed in ServiceL call.
-		// It was stored either in iConnectBearerMsg or iDisconnectBearerMsg member.
-		// This also means that this message is not "pending" any more 
-		// (as processing of its copy has been started). 
-		// However because the copy will get completed we need to 
-		// clean iPendingMsg.iHandle here
-		// To supress coverity error for uninitialized use of 'emptyMsg' coverity annotations
-		// are used as the in-line default constructor of RMessage2 doesn't initialize all member variables.
-		// coverity[var_decl]
-		RMessage2 emptyMsg;
-		iPendingMsg = emptyMsg;
-		}
-	}
-
 
 TInt CRemConSession::SupportedInterfaces(RArray<TUid>& aUids)
 	{
-	LOG_FUNC
+	LOG_FUNC;
+
+	aUids.Reset();
+	return AppendSupportedInterfaces(aUids);
+	}
+
+TInt CRemConSession::AppendSupportedInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
 	ASSERT_DEBUG(iInterestedAPIs);
 	TInt err = KErrNone;
-	
-	aUids.Reset();
+
 	TInt count = iInterestedAPIs->Array().Count();
 	for(TInt i=0; (i<count) && (err == KErrNone); i++)
 		{
@@ -1762,11 +815,18 @@
 
 TInt CRemConSession::SupportedBulkInterfaces(RArray<TUid>& aUids)
 	{
-	LOG_FUNC
+	LOG_FUNC;
+
+    	aUids.Reset();
+	return AppendSupportedBulkInterfaces(aUids);
+	}
+
+TInt CRemConSession::AppendSupportedBulkInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC;
 	ASSERT_DEBUG(iInterestedAPIs);
 	TInt err = KErrNone;
-	
-	aUids.Reset();
+
 	TInt count = iInterestedAPIs->Array().Count();
 	for(TInt i=0; (i<count) && (err == KErrNone); i++)
 		{
@@ -1777,13 +837,13 @@
 			err = aUids.Append(details->Uid());
 			}
 		}
-	
+
 	return err;
 	}
 
 TInt CRemConSession::SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations)
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	TInt err = KErrNotSupported;
 	CRemConInterfaceDetails* details = FindInterfaceByUid(aInterfaceUid);
 	
@@ -1796,7 +856,7 @@
 
 CRemConInterfaceDetails* CRemConSession::FindInterfaceByUid(TUid aUid) const
 	{
-	LOG_FUNC
+	LOG_FUNC;
 	ASSERT_DEBUG(iInterestedAPIs);
 	TInt count = iInterestedAPIs->Array().Count();
 	for(TInt ix=0; ix<count; ++ix)
@@ -1811,4 +871,21 @@
 	return NULL;
 	}
 
+void CRemConSession::DoSendNext()
+	{
+	LOG_FUNC;
 
+	ASSERT_DEBUG(iSendQueue);
+	CRemConMessage& msg = iSendQueue->First();
+	iSendQueue->Remove(msg);
+	SendToServer(msg);
+	}
+
+TInt CRemConSession::SendNextCb(TAny *aThis)
+	{
+	LOG_STATIC_FUNC;
+
+	static_cast<CRemConSession*>(aThis)->DoSendNext();
+	return KErrNone;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/src/targetclientprocess.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,459 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side representation of a target client, which may have multiple 
+// sessions associated with it.
+// 
+
+
+#include <e32base.h>
+#include <bluetooth/logger.h>
+
+#include "server.h"
+#include "bearermanager.h"
+#include "remconmessage.h"
+#include "targetsession.h"
+
+#include "targetclientprocess.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("tgclient");
+#endif
+
+TBool TargetSessionCompareUsingSupportedInterface(const TUid* aInterfaceUid, const CRemConTargetSession& aSession)
+	{
+	return aSession.InterfaceSupported(*aInterfaceUid);
+	}
+
+TBool TargetSessionCompareUsingSupportedMessage(const CRemConMessage* aMessage, const CRemConTargetSession& aSession)
+	{
+	return aSession.SupportedMessage(*aMessage);
+	}
+
+CRemConTargetClientProcess* CRemConTargetClientProcess::NewLC(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager)
+	{
+	LOG_STATIC_FUNC
+
+	CRemConTargetClientProcess* result = new (ELeave) CRemConTargetClientProcess(aClientInfo, aClientId, aServer, aBearerManager);
+	CleanupStack::PushL(result);
+	return result;
+	}
+
+CRemConTargetClientProcess::CRemConTargetClientProcess(TClientInfo& aClientInfo, TRemConClientId aClientId, CRemConServer& aServer, CBearerManager& aBearerManager)
+	: iClientInfo(aClientInfo),
+	iClientId(aClientId),
+	iServer(aServer),
+	iBearerManager(aBearerManager),
+	iPlayerInfoSet(EFalse),
+	iTargetSessions(KMaxNumberTargetSessions)
+	{
+	LOG_FUNC
+	}
+
+CRemConTargetClientProcess::~CRemConTargetClientProcess()
+	{
+	LOG_FUNC
+
+	iPlayerName.Close();
+	iTargetSessions.Close();
+	iServer.TargetClientClosed(*this);
+	}
+
+CRemConTargetSession* CRemConTargetClientProcess::NewSessionL(TUint aSessionId)
+	{
+	LOG_FUNC
+	CRemConTargetSession* sess = NULL;
+
+	// Only create a session if we havent reached our maximum.
+	if (TargetSessionCount() < KMaxNumberTargetSessions)
+		{
+		sess = CRemConTargetSession::NewL(*this, iServer, iBearerManager, aSessionId);
+		}
+	else
+		{
+		LEAVEIFERRORL(KErrOverflow);
+		}
+
+	return sess;
+	}
+
+
+TInt CRemConTargetClientProcess::TargetSessionOpened(CRemConTargetSession& aSession)
+	{
+	LOG_FUNC
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession)
+
+	// Register the session by appending it to our array and asking the server to
+	// make an item for it in the record of which points in the connection history 
+	// sessions are interested in.
+	ASSERT(iTargetSessions.Count() < KMaxNumberTargetSessions);	// Should have been caught by now.
+
+	// The append should never fail because the RPointerArray was constructed with a granularity of 
+	// KMaxNumberTargetSessions items.
+#ifdef _DEBUG	
+	TInt err = iTargetSessions.Append(&aSession);
+	ASSERT(err == KErrNone);
+#else
+	static_cast<void>(iTargetSessions.Append(&aSession));
+#endif
+
+	TInt ret = iServer.RegisterTargetSessionPointerToConnHistory(aSession);
+			
+	if ( ret != KErrNone )
+		{
+		iTargetSessions.Remove(iTargetSessions.Count() - 1);
+		}
+	else
+		{
+		// Session successfully registered.
+		iServer.CancelShutdownTimer();
+		}
+	
+	LOG1(_L("\tret = %d"), ret)
+	return ret;
+	}
+
+void CRemConTargetClientProcess::TargetSessionClosed(CRemConTargetSession& aSession)
+	{
+	LOG_FUNC
+	LOG1(_L("\t&aSession = 0x%08x"), &aSession)
+
+	// Remove session from our list
+	TInt sessionIndex = iTargetSessions.Find(&aSession);
+
+	if (sessionIndex > KErrNotFound)
+		{
+		iTargetSessions.Remove(sessionIndex);
+
+		// Inform server that session has dropped. 			
+		iServer.TargetSessionClosed(*this, aSession);
+		
+		if (iTargetSessions.Count() > 0)
+		    {
+            iServer.TargetFeaturesUpdated(*this);
+		    }
+		
+		}
+	}
+
+void CRemConTargetClientProcess::SetPlayerInformationL(const TPlayerTypeInformation& aPlayerType, const TDesC8& aPlayerName)
+	{
+	LOG_FUNC
+	ASSERT_DEBUG(!HasPlayerInformation());
+
+	if (!HasPlayerInformation())
+		{
+		iPlayerName.CreateL(aPlayerName);
+		iPlayerType = aPlayerType;
+		iPlayerInfoSet = ETrue;
+		}
+	}
+
+void CRemConTargetClientProcess::InterfacesRegistered()
+	{
+	LOG_FUNC
+
+	// If this client has not been made available yet, do so now.
+	// Otherwise, notify the server that new interfaces have been registered. 
+	if (!iClientAvailable)
+		{
+		iServer.TargetClientAvailable(*this);	
+		iClientAvailable = ETrue;
+		}
+	else
+		{
+		iServer.TargetFeaturesUpdated(*this);
+		}
+
+	}
+
+TBool CRemConTargetClientProcess::IsInterfaceTypeRegisteredByAnotherSession(CRemConTargetSession& aSession, TUid aInterfaceUid) const
+	{
+	LOG_FUNC
+
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i=0; i < sessionCount; ++i)
+		{
+		if (aSession.Id() != iTargetSessions[i]->Id())
+			{
+			if (iTargetSessions[i]->InterfaceSupported(aInterfaceUid))
+				{
+				return ETrue;
+				}
+			}
+		}
+
+	return EFalse;
+	}
+
+TInt CRemConTargetClientProcess::ReceiveMessage(CRemConMessage& aMessage)
+	{
+	LOG_FUNC
+
+	// Find the session supporting this message
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+
+	if (sess)
+		{
+		// Session found. Check session is able to handle this message.
+		if (sess->CurrentReceiveMessage().Handle())
+			{
+			// Pass message to session and return the error code obtained.
+			return sess->WriteMessageToClient(aMessage);
+			}
+		else
+			{
+			// Session not able to handle message at this time.
+			return KErrNotReady;
+			}
+		}
+	else
+		{
+		// No session supports this message
+		return KErrArgument;
+		}
+	}
+
+void CRemConTargetClientProcess::ConnectionsChanged()
+	{
+	LOG_FUNC
+
+	// Notify each session
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i = 0; i < sessionCount; ++i)
+		{
+		iTargetSessions[i]->ConnectionsChanged();
+		}
+	}
+
+TInt CRemConTargetClientProcess::SupportedInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC
+	
+	TInt err = KErrNone;
+	aUids.Reset();
+
+	// Gather the list of supported interfaces from each session.
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i = 0 ; i < sessionCount && err == KErrNone; ++i)
+		{
+		err = iTargetSessions[i]->AppendSupportedInterfaces(aUids);
+		}
+
+	return err;
+	}
+
+TInt CRemConTargetClientProcess::SupportedBulkInterfaces(RArray<TUid>& aUids)
+	{
+	LOG_FUNC
+	
+	TInt err = KErrNone;
+	aUids.Reset();
+
+	// Gather the list of supported bulk interfaces from each session.
+	TUint sessionCount = iTargetSessions.Count();
+	for (TUint i = 0 ; i < sessionCount && err == KErrNone; ++i)
+		{
+		err = iTargetSessions[i]->AppendSupportedBulkInterfaces(aUids);
+		}
+
+	return err;
+	}
+
+TInt CRemConTargetClientProcess::SupportedOperations(TUid aInterfaceUid, RArray<TUint>& aOperations)
+	{
+	LOG_FUNC
+
+	// Find the session supporting this interface.
+	TInt sessIndex = FindSessionForInterface(aInterfaceUid);
+
+	if (sessIndex >= KErrNone)
+		{
+		return iTargetSessions[sessIndex]->SupportedOperations(aInterfaceUid, aOperations);
+		}
+	else
+		{
+		// Interface not found, so operation not supported.
+		return KErrNotSupported;
+		}
+	}
+
+CRemConTargetSession* CRemConTargetClientProcess::FindSessionForMessage(const CRemConMessage& aMessage)
+	{
+	LOG_FUNC
+
+	TInt result = iTargetSessions.Find(aMessage, TargetSessionCompareUsingSupportedMessage);
+	if (result >= KErrNone)
+		{
+		return iTargetSessions[result];
+		}
+	else
+		{
+		return NULL;
+		}
+
+	}
+
+TInt CRemConTargetClientProcess::FindSessionForInterface(TUid aInterfaceUid) const
+	{
+	LOG_FUNC
+
+	return iTargetSessions.Find(aInterfaceUid, TargetSessionCompareUsingSupportedInterface);
+	}
+
+void CRemConTargetClientProcess::CompleteMessageForSession(const CRemConMessage& aMessage, CRemConTargetSession& aSession)
+	{
+	LOG_FUNC
+
+	// Targets can only send responses or rejects.
+	switch (aMessage.MsgType())
+		{
+	case ERemConResponse:
+	case ERemConReject:
+		aSession.CompleteSend();
+		break;
+	default:
+		ASSERT_DEBUG(EFalse);
+		break;
+		}
+
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendResult(const CRemConMessage& /*aMessage*/, TInt /*aError*/)
+	{
+	LOG_FUNC
+	
+	// This method should never be called, as it is not required to support target client processes.
+	ASSERT_DEBUG(EFalse);
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreAttempt(const CRemConMessage& aMessage, TUint aNumRemotes)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Session should not already be sending a message to n remotes
+	ASSERT_DEBUG(sess->NumRemotesToTry() == 0);
+
+	sess->NumRemotes() = 0;
+	sess->NumRemotesToTry() = aNumRemotes;
+	sess->SendError() = KErrNone;
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreIncremental(const CRemConMessage& aMessage, TUint aNumRemotes)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+
+	if (sess->NumRemotesToTry() == 0)
+		{
+		MrcmsoMessageSendOneOrMoreAttempt(aMessage,aNumRemotes);
+		}
+	else
+		{
+		// No send should have yet been attempted
+		ASSERT_DEBUG(sess->NumRemotes() == 0);
+
+		sess->NumRemotesToTry() += aNumRemotes;
+		}
+	}
+	
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreAttemptFailed(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Session should not already be sending a message to n remotes
+	ASSERT_DEBUG(sess->NumRemotesToTry() == 0);
+
+	sess->NumRemotes() = 0;
+	sess->SendError() = aError;
+	CompleteMessageForSession(aMessage, *sess);
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreResult(const CRemConMessage& aMessage, TInt aError)
+	{
+	LOG_FUNC
+
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+	
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Ignore notification if client has been completed
+	if (sess->NumRemotesToTry() > 0)
+		{
+		// Only set error if different from KErrNone
+		if (aError == KErrNone)
+			{
+			++sess->NumRemotes();
+			}
+		else
+			{
+			sess->SendError() = aError;
+			}
+
+		--sess->NumRemotesToTry();
+		if (sess->NumRemotesToTry() == 0)
+			{
+			CompleteMessageForSession(aMessage, *sess);
+			}
+		}
+	}
+
+void CRemConTargetClientProcess::MrcmsoMessageSendOneOrMoreAbandoned(const CRemConMessage& aMessage)
+	{
+	LOG_FUNC
+	
+	// Notifications should not be received for reject messages, as the client did not request these be sent.
+	ASSERT_DEBUG(aMessage.MsgType() != ERemConReject);
+
+	// Find session and notify
+	CRemConTargetSession* sess = FindSessionForMessage(aMessage);
+	ASSERT_DEBUG(sess);
+	
+	// Ignore notification if client has been completed
+	if (sess->NumRemotesToTry() > 0)
+		{
+		// Do not adjust NumRemotes() as the message was not sent (but we still don't error the client!)
+		--sess->NumRemotesToTry();
+		if (sess->NumRemotesToTry() == 0)
+			{
+			CompleteMessageForSession(aMessage, *sess);
+			}
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessoryservices/remotecontrolfw/server/src/targetsession.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -0,0 +1,331 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <bluetooth/logger.h>
+#include <remcon/remconifdetails.h>
+#include "messagequeue.h"
+#include "remconmessage.h"
+#include "remconserver.h"
+#include "server.h"
+#include "targetsession.h"
+#include "utils.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
+#endif
+
+#ifdef _DEBUG
+PANICCATEGORY("tgsession");
+#endif
+
+CRemConTargetSession* CRemConTargetSession::NewL(CRemConTargetClientProcess& aClientProcess,
+	CRemConServer& aServer,
+	CBearerManager& aBearerManager,
+	TUint aId)
+	{
+	LOG_STATIC_FUNC;
+	CRemConTargetSession* self = new(ELeave) CRemConTargetSession(aClientProcess, aServer, aBearerManager, aId);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CLEANUPSTACK_POP1(self);
+	return self;
+	}
+
+CRemConTargetSession::~CRemConTargetSession()
+	{
+	LOG_FUNC;
+
+	// Tell the client process representation we've gone away- it may start its shutdown timer.
+	iClientProcess.TargetSessionClosed(*this);
+	}
+
+CRemConTargetSession::CRemConTargetSession(CRemConTargetClientProcess& aClientProcess,
+	CRemConServer& aServer, 
+	CBearerManager& aBearerManager,
+	TUint aId)
+	: CRemConSession(aServer, aBearerManager, aId),
+	iClientProcess(aClientProcess)
+	{
+	LOG_FUNC;
+	}
+
+void CRemConTargetSession::ConstructL()
+	{
+	LOG_FUNC;
+
+	BaseConstructL(iClientProcess.ClientInfo());
+
+	// Tell the client process representation about us (this will in turn inform the server).
+	LEAVEIFERRORL(iClientProcess.TargetSessionOpened(*this));
+	
+	// Set our pointer into the connection history at the current/'Last' item.
+	// Can't do this til we've told the server we exist
+	iServer.SetConnectionHistoryPointer(Id());
+	}
+
+TBool CRemConTargetSession::SupportedMessage(const CRemConMessage& aMsg) const
+	{
+	LOG_FUNC;
+
+	// Return true if the message is for an interface supported by this session
+	return InterfaceSupported(aMsg.InterfaceUid());
+	}
+
+TBool CRemConTargetSession::InterfaceSupported(TUid aInterfaceUid) const
+	{
+	LOG_FUNC;
+	LOG2(_L("\taInterfaceUid = 0x%08x, iInterestedAPIs = %d"), aInterfaceUid, iInterestedAPIs);
+
+	TBool result = iInterestedAPIs ? (FindInterfaceByUid(aInterfaceUid) != NULL) : EFalse;
+
+	LOG1(_L("result = %d"), result);
+	return result;
+	}
+
+void CRemConTargetSession::SetPlayerType(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	TInt err = aMessage.GetDesLength(1);
+	if (err >= 0)
+		{
+		TPlayerTypeInformation playerType;
+		RBuf8 playerName;
+	
+		TRAP(err, GetPlayerTypeAndNameL(aMessage, playerType, playerName));
+
+		if (err == KErrBadDescriptor)
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicBadDescriptor);
+			playerName.Close();
+			return;
+			}
+		else if (err == KErrArgument)
+			{
+			PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicIllegalIpc);
+			playerName.Close();
+			return;			
+			}
+		else if (err == KErrNone)
+			{
+			// If player type is not set, then update iClientProcess with information.
+			// If player type is already set, then dont allow this to be changed for the client (panic the client if the information is different).
+			if (!iClientProcess.HasPlayerInformation())
+				{
+				TRAP(err, iClientProcess.SetPlayerInformationL(playerType, playerName));
+				}
+			else if (!iClientProcess.PlayerInformationMatches(playerType, playerName))
+				{
+				PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicPlayerInfoAlreadySet);
+				playerName.Close();
+				return;
+				}
+			}
+
+		playerName.Close();
+		}
+	else if (err == KErrBadDescriptor)
+		{	
+		// The additional parameters are optional (i.e. old target clients won't provide them).
+		err = KErrNone;
+		}
+	
+	CompleteClient(aMessage, err);
+	}
+
+CRemConMessage* CRemConTargetSession::DoPrepareSendMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	if (!DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes))
+		{
+		// DoGetSendInfoLC() panicked the message
+		return NULL;	
+		}
+
+	CRemConMessage* msg = NULL;
+	
+	LOG(_L("\tTARGET send"));
+
+	msg = CRemConMessage::NewL(
+		TRemConAddress(), // we don't know which remotes it's going to yet
+		ERemConResponse, // targets can only send responses
+		messageSubType,
+		interfaceUid,
+		operationId,
+		sendDes, // msg takes ownership
+		iClientProcess.Id(), // session id to match this response against the originating command
+		0, // transaction id not yet known
+		ETrue);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+	
+	return msg;
+	}
+
+void CRemConTargetSession::SendUnreliable(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Check we've had our features set...
+	if (!ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	CRemConMessage* msg = NULL;
+	TRAPD(err, msg = DoCreateUnreliableMessageL(aMessage));
+	CompleteClient(aMessage, err);
+	if (err == KErrNone)
+		{
+		ASSERT_DEBUG(iSendQueue);
+		if (iSending || !iSendQueue->IsEmpty())
+			{
+			iSendQueue->Append(*msg);
+			}
+		else
+			{
+			SendToServer(*msg);
+			}
+		}
+	}
+
+CRemConMessage* CRemConTargetSession::DoCreateUnreliableMessageL(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+
+	// Get the data the client wants to send.
+	TUid interfaceUid;
+	TUint operationId;
+	TRemConMessageSubType messageSubType;
+	RBuf8 sendDes;
+	DoGetSendInfoLC(aMessage, interfaceUid, operationId, messageSubType, sendDes);
+
+	// Before we ask the server to send, we must set our ClientInfo 
+	// correctly so the TSP can get information about the client. 
+	iClientInfo.Message() = aMessage;
+
+	CRemConMessage* msg = NULL;
+	
+	LOG(_L("\tTARGET send"));
+
+	msg = CRemConMessage::NewL(
+		TRemConAddress(), // we don't know which remotes it's going to yet
+		ERemConResponse, // targets can only send responses
+		messageSubType,
+		interfaceUid,
+		operationId,
+		sendDes, // msg takes ownership
+		iClientProcess.Id(), // session id to match this response against the originating command
+		0, // transaction id not yet known
+		EFalse);
+	CLEANUPSTACK_POP1(&sendDes); // now owned by msg
+
+	return msg;
+	}
+
+void CRemConTargetSession::DoSendCancel()
+	{
+	LOG_FUNC;
+
+	// We do not cancel any pending response messages, so don't need
+	// to notify the server here.
+
+	NumRemotesToTry() = 0;
+	iSendError = KErrCancel;
+	CompleteSend();
+	}
+
+void CRemConTargetSession::RegisterInterestedAPIs(const RMessage2& aMessage)
+	{
+	LOG_FUNC;
+	
+	// Check we haven't had our features set yet
+	if (ClientAvailable())
+		{
+		PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientFeaturesNotSet);
+		return;
+		}
+
+	CRemConInterfaceDetailsArray* interfaces = NULL;
+	TRAPD(err, interfaces = ExtractInterestedAPIsL(aMessage));
+	
+	if(err == KErrNone)
+		{
+		// Ensure that none of these interfaces have already been registered by the client.
+		// Also note if bulk server is required.
+		TInt count = interfaces->Array().Count();
+		TBool bulkServerRequired = EFalse;
+		for (TInt ix=0; ix < count; ++ix)
+			{
+			CRemConInterfaceDetails* details = interfaces->Array()[ix];
+			ASSERT_DEBUG(details);
+			if (iClientProcess.IsInterfaceTypeRegisteredByAnotherSession(*this, details->Uid()))
+				{
+				// Destroy new interfaces and panic client.
+				delete interfaces;
+				PANIC_MSG(aMessage, KRemConClientPanicCat, ERemConClientPanicClientInterfaceAlreadyRegistered);
+				return;
+				}
+			else if (details->IsBulk())
+				{
+				bulkServerRequired = ETrue;
+				}
+			}
+	
+		// Interfaces are OK, notify server if bulk server is required.
+		iInterestedAPIs = interfaces;
+		iClientProcess.InterfacesRegistered();
+		if (bulkServerRequired)
+			{
+			iServer.BulkServerRequired();
+			}
+		}
+	else
+		{
+		ASSERT_DEBUG(interfaces == NULL);
+		}
+	
+	CompleteClient(aMessage, err);
+	}
+
+void CRemConTargetSession::SendToServer(CRemConMessage& aMsg)
+	{
+	LOG_FUNC;
+	
+	// Set our completion members.
+	NumRemotes() = 0;
+	NumRemotesToTry() = 0;
+	SendError() = KErrNone;
+
+	
+	iSending = (aMsg.IsReliableSend()) ? ESendingReliable: ESendingUnreliable;
+
+	iServer.SendResponse(aMsg, iClientProcess);
+	}
+
+void CRemConTargetSession::DoReceive()
+	{
+	// Request messages from the server on behalf of the client.
+	// If there's anything waiting to be given to us, iClientProcess will call 
+	// back to us with it.
+	iServer.ReceiveRequest(iClientProcess);
+	}
--- a/accessoryservices/tspclientmapper/tsrc/public/basic/tspclienttestmodule/group/tspclienttestmodule.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/accessoryservices/tspclientmapper/tsrc/public/basic/tspclienttestmodule/group/tspclienttestmodule.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -41,7 +41,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         accclient.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         tspclientmapper.lib
 
 LANG            SC
--- a/commonservices/PlatformEnv/disknotifyhandler/tsrc/disknotifyhandlertest/group/disknotifyhandlertest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/commonservices/PlatformEnv/disknotifyhandler/tsrc/disknotifyhandlertest/group/disknotifyhandlertest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -34,7 +34,7 @@
 MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY     euser.lib
-LIBRARY     stiftestinterface.lib
+LIBRARY     StifTestInterface.lib
 LIBRARY     disknotifyhandler.lib
 LIBRARY     efsrv.lib
 LIBRARY     bafl.lib
--- a/commonservices/PlatformEnv/platformver/tsrc/platformvertest/group/platformvertest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/commonservices/PlatformEnv/platformver/tsrc/platformvertest/group/platformvertest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -37,7 +37,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         platformver.lib
 LANG            SC
 
--- a/commonservices/PlatformEnv/sysversioninfo/tsrc/sysutiltests/group/sysutiltests.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/commonservices/PlatformEnv/sysversioninfo/tsrc/sysutiltests/group/sysutiltests.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -39,7 +39,7 @@
 LIBRARY 	sysversioninfo.lib
 LIBRARY		CommonEngine.lib
 LIBRARY		efsrv.lib
-LIBRARY     stiftestinterface.lib
+LIBRARY     StifTestInterface.lib
 
 epocstacksize 0x4000
 
--- a/commonservices/PlatformEnv/tsrc/platformenvtest/group/PlatformEnvTest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/commonservices/PlatformEnv/tsrc/platformenvtest/group/PlatformEnvTest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -40,7 +40,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         PlatformEnv.lib
 LANG            SC
 
--- a/devicesrv_plat/accessory_plugin_api/inc/ASYCommandHandlerBase.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_plat/accessory_plugin_api/inc/ASYCommandHandlerBase.h	Mon Oct 04 02:28:24 2010 +0300
@@ -20,12 +20,12 @@
 #define CASYCOMMANDHANDLERBASE_H
 
 //  INCLUDES
-#include <asycmdtypes.h>
+#include <AsyCmdTypes.h>
 #include <e32std.h>
 #include <e32base.h>
 #include <ecom/ecom.h>
-#include <accessorytypes.h>
-#include <asymainservicebase.h>
+#include <AccessoryTypes.h>
+#include <AsyMainServiceBase.h>
 
 // CONSTANTS
 
--- a/devicesrv_plat/accessory_plugin_api/inc/ASYMainServiceBase.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_plat/accessory_plugin_api/inc/ASYMainServiceBase.h	Mon Oct 04 02:28:24 2010 +0300
@@ -20,8 +20,8 @@
 #define CASYMAINSERVICEBASE_H
 
 // INCLUDES
-#include "asyproxytypes.h"
-#include <asycmdtypes.h>
+#include "AsyProxyTypes.h"
+#include <AsyCmdTypes.h>
 #include <e32std.h>
 #include <e32base.h>
 #include <ecom/ecom.h>
--- a/devicesrv_plat/dos_extension_api/inc/dossvrservices.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_plat/dos_extension_api/inc/dossvrservices.h	Mon Oct 04 02:28:24 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-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"
@@ -23,7 +23,7 @@
 
 // INCLUDES
 #include <e32base.h>
-#include <psvariables.h>
+#include <PSVariables.h>
 #include <bttypes.h> // TBTDevAddr, THCIConnHandle
 
 /**
@@ -464,7 +464,7 @@
 	TBool iOwnServer;
 };
 
-#include "dossvrservices.inl"
+#include "DosSvrServices.inl"
 
 
 #endif // __DOSSVRSERVICES_H__
--- a/devicesrv_pub/accessory_monitoring_api/tsrc/bc/accmonapibctests/group/AccMonAPIBCTests.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_pub/accessory_monitoring_api/tsrc/bc/accmonapibctests/group/AccMonAPIBCTests.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -36,7 +36,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         accmonitor.lib
 
 LANG            SC
--- a/devicesrv_pub/platform_environment_api/tsrc/bc/platformenv/group/PlatformEnvTest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_pub/platform_environment_api/tsrc/bc/platformenv/group/PlatformEnvTest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -44,7 +44,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         PlatformEnv.lib
 LANG            SC
 
--- a/devicesrv_pub/sensor_channel_api/tsrc/sensor/group/sensortest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_pub/sensor_channel_api/tsrc/sensor/group/sensortest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -43,7 +43,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         sensrvutil.lib
 LIBRARY         SensrvClient.lib
 LIBRARY         centralrepository.lib
--- a/devicesrv_pub/sensor_data_compensator_api/tsrc/sensordatacompensatortest/group/sensordatacompensatortest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_pub/sensor_data_compensator_api/tsrc/sensordatacompensatortest/group/sensordatacompensatortest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -34,6 +34,6 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY     euser.lib
-LIBRARY     stiftestinterface.lib
+LIBRARY     StifTestInterface.lib
 LIBRARY     sensordatacompensator.lib
 
--- a/devicesrv_pub/version_info_api/tsrc/bc/platformvertest/group/platformvertest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/devicesrv_pub/version_info_api/tsrc/bc/platformvertest/group/platformvertest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -37,7 +37,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         platformver.lib
 LANG            SC
 
--- a/dosservices/tsrc/dsytesttool/dsytfstifadapter/group/dsytfstifadapter.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/dosservices/tsrc/dsytesttool/dsytfstifadapter/group/dsytfstifadapter.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -47,7 +47,7 @@
 // Dependencies to system components
 LIBRARY         euser.lib
 LIBRARY         dsytfcore.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 
 //MACRO           COMPONENT_TRACE_FLAG
 
--- a/hwrmhaptics/hapticsclient/src/hwrmhapticssession.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/hwrmhaptics/hapticsclient/src/hwrmhapticssession.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -155,11 +155,17 @@
         }
         
     User::WaitForRequest( status );
+    	
+    // We can't use the 'exit reason' if the server paniced as this
+    // is the panic 'reason' and may be '0' which cannot be distinguished
+    // from KErrNone
+    ret = (server.ExitType() == EExitPanic)? KErrGeneral : status.Int();
+    	
     server.Close();
 
-    COMPONENT_TRACE( ( _L( "RHWRMHapticsSession::StartServer - return %d" ), status.Int() ) );
+    COMPONENT_TRACE( ( _L( "RHWRMHapticsSession::StartServer - return %d" ), ret ) );
 
-    return status.Int();    
+    return ret;    
     }
 
 // ---------------------------------------------------------------------------
--- a/mediator/tsrc/public/basic/group/MediatorTest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/mediator/tsrc/public/basic/group/MediatorTest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -38,7 +38,7 @@
 
 LIBRARY         euser.lib
 LIBRARY         ecom.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         MediatorClient.lib
 LIBRARY         MediatorPluginBase.lib
 
--- a/psmservices/psmserver/tsrc/PsmTestModule/group/PsmTestModule.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/psmservices/psmserver/tsrc/PsmTestModule/group/PsmTestModule.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -43,7 +43,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY         psmclient.lib
 LIBRARY         centralrepository.lib
 
--- a/resourcemgmt/hwresourcesmgr/include/HWRMPowerStateSDKPSKeys.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/include/HWRMPowerStateSDKPSKeys.h	Mon Oct 04 02:28:24 2010 +0300
@@ -136,6 +136,20 @@
 const TUint32 KHWRMBatteryStatus = 0x00000002;
 
 /**
+ * Battery status of device. 
+ *
+ * This Property is a replacement for the existing property KHWRMBatteryStatus.
+ * It is strictly recommended to use the new property by any up-coming applications.
+ * Legacy property, KHWRMBatteryStatus, will be deprecated in the very next release.
+ *
+ * @see EPSHWRMBatteryStatus
+ *
+ * @publishedAll
+ * @released
+ */
+const TUint32 KHWRMExtendedBatteryStatus = 0x00000004;
+
+/**
 * Battery status of device.
 *
 * @publishedAll
@@ -144,9 +158,19 @@
 enum EPSHWRMBatteryStatus
     {
     /**
-    Uninitialized or some other error
+		Uninitialized or some other error e.g.server not intialized
     */
-    EBatteryStatusUnknown        = -1, 
+		EBatteryStatusUnknown        							= -1,
+		/**
+		* e.g. Chemistry not supported like LiFePo or general battery not supported error
+		* Show "charging not allowed" note to user
+		*/
+		EBatteryStatusNotSupported								= -2,
+		/**
+		* e.g. Pirated Battery with wrong DBI Chip / DBI authentication failed
+		* Show "charging not allowed" note to user
+		*/
+		EBatteryStatusDbiAuthFailed        				= -3,    
     /**
     This can also be used during charging
     */
@@ -173,6 +197,20 @@
 const TUint32 KHWRMChargingStatus = 0x00000003;
 
 /**
+ * Charging status of device.
+ *
+ * This Property is a replacement for the existing property KHWRMChargingStatus.
+ * It is strictly recommended to use the new property by any up-coming applications.
+ * Legacy property, KHWRMChargingStatus, will be deprecated in the very next release.
+ *
+ * @see EPSHWRMChargingStatus
+ *
+ * @publishedAll
+ * @released
+ */
+const TUint32 KHWRMExtendedChargingStatus = 0x00000005;
+
+/**
 * Charging status of device.
 *
 * @publishedAll
@@ -181,9 +219,29 @@
 enum EPSHWRMChargingStatus
     {
     /**
-    Some error has occurred when charger is connected or charging. 
+    Some error has occurred when charger is connected or charging.    
     */
-    EChargingStatusError              = -1, 
+    EChargingStatusError                        = -1,
+    /**
+     * Illegal charger is connected, device cannot charge
+     */
+    EChargingStatusIllegalChargerError          = -2,
+    /**
+     * Charger is under voltage, device cannot charge
+     */
+    EChargingStatusChargerUnderVoltageError     = -3,
+    /**
+     * Charger is over voltage, device cannot charge
+     */
+    EChargingStatusChargerOverVoltageError      = -4,
+    /**
+     * Wait for battery temperature to normalize before charging to proceed
+     */
+    EChargingStatusTempTooHotError              = -5,
+    /**
+     * Wait for battery temperature to normalize for charging
+     */
+    EChargingStatusTempTooColdError             = -6,
     /**
     Charger not connected/uninitialized
     */
--- a/resourcemgmt/hwresourcesmgr/power/inc/HWRMPower.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/power/inc/HWRMPower.h	Mon Oct 04 02:28:24 2010 +0300
@@ -136,13 +136,22 @@
         EBatteryChargerUnKnown = 0, 
         EBatteryChargerDedicated = 1, 
         EBatteryChargerUsbDedicated = 2,
-        EBatteryChargerUsbHost = 3 
+        EBatteryChargerUsbHost = 3,
+      	// Hi-speed USB host
+				EBatteryChargerUsbHispeedHost 		= 4,
+				// USB host with accessory charger adapter
+				EBatteryChargerUsbAca 			= 5,
         };
 
     /* The current charging status of the device. */
     enum TBatteryChargingStatus
         {
-        EChargingStatusError              = -1, 
+        EChargingStatusError                    = -1,
+        EChargingStatusIllegalChargerError      = -2,
+        EChargingStatusChargerUnderVoltageError = -3,
+        EChargingStatusChargerOverVoltageError  = -4,
+        EChargingStatusTempTooHotError          = -5,
+        EChargingStatusTempTooColdError         = -6,
         EChargingStatusNotConnected       = 0,  
         EChargingStatusCharging           = 1,  
         EChargingStatusNotCharging        = 2,  
--- a/resourcemgmt/hwresourcesmgr/power/src/HWRMChargingStatusObserver.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/power/src/HWRMChargingStatusObserver.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -64,7 +64,7 @@
     {
     COMPONENT_TRACE1(_L( "HWRM CHWRMChargingStatusObs - CHWRMChargingStatusObs::ConstructL()"));
     
-    iChargingPsObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMChargingStatus, *this);    
+    iChargingPsObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMExtendedChargingStatus, *this);    
     
     COMPONENT_TRACE1(_L( "HWRM CHWRMChargingStatusObs - CHWRMChargingStatusObs::ConstructL() - return"));    
     }
@@ -72,7 +72,7 @@
 
 void CHWRMChargingStatusObs::PsPropertyChanged(TInt aKey, TInt aValue, TInt aError)
     {
-    if((aKey == KHWRMChargingStatus)&&(iChargingStatusObserver)&&
+    if((aKey == KHWRMExtendedChargingStatus)&&(iChargingStatusObserver)&&
         (iChargingStatus != aValue))
         {
         iChargingStatus = aValue;
--- a/resourcemgmt/hwresourcesmgr/power/src/HWRMPowerImpl.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/power/src/HWRMPowerImpl.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -415,7 +415,7 @@
     err = DoGetBatteryChargingStatus(chargingStatus);
     
     if((err != KErrNone) || 
-       (chargingStatus == CHWRMPower::EChargingStatusError) || 
+       (chargingStatus <= CHWRMPower::EChargingStatusError) || 
        (chargingStatus == CHWRMPower::EChargingStatusNotConnected) || 
        (chargingStatus == CHWRMPower::EChargingStatusNotCharging))
         {
@@ -467,7 +467,7 @@
     err = DoGetBatteryChargingStatus(chargingStatus);
     
     if((err != KErrNone) || 
-       (chargingStatus == CHWRMPower::EChargingStatusError) || 
+       (chargingStatus <= CHWRMPower::EChargingStatusError) ||
        (chargingStatus == CHWRMPower::EChargingStatusNotConnected) || 
        (chargingStatus == CHWRMPower::EChargingStatusNotCharging))
         {
@@ -556,7 +556,7 @@
         
         //Stop charging notifications, if charger is not connected.
         if((aErrCode != KErrNone) || 
-           (aChrgStatus == CHWRMPower::EChargingStatusError) || 
+           (aChrgStatus <= CHWRMPower::EChargingStatusError) ||
            (aChrgStatus == CHWRMPower::EChargingStatusNotConnected) || 
            (aChrgStatus == CHWRMPower::EChargingStatusNotCharging))
             {
--- a/resourcemgmt/hwresourcesmgr/server/inc/HWRMPowerStatePluginHandler.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/server/inc/HWRMPowerStatePluginHandler.h	Mon Oct 04 02:28:24 2010 +0300
@@ -101,6 +101,8 @@
 	    RProperty iBattLevelProp;
 	    RProperty iBattStatusProp;
 	    RProperty iChargingStatusProp;
+	    RProperty iExtendedBattStatusProp;
+        RProperty iExtendedChargingStatusProp;
 	    
 	    // If ETrue, connecting charger blocks vibra
 	    TBool iChargerBlockVibra;
--- a/resourcemgmt/hwresourcesmgr/server/plugininc/HWRMPowerCommands.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/server/plugininc/HWRMPowerCommands.h	Mon Oct 04 02:28:24 2010 +0300
@@ -85,7 +85,9 @@
         EBatteryChargerUnKnown = 0, 
         EBatteryChargerDedicated = 1, 
         EBatteryChargerUsbDedicated = 2,
-        EBatteryChargerUsbHost = 3 
+        EBatteryChargerUsbHost = 3,
+        EBatteryChargerUsbHispeedHost = 4,
+        EBatteryChargerUsbAca = 5,
         };
 
     struct TBatteryChargerTypeData
--- a/resourcemgmt/hwresourcesmgr/server/src/HWRMPowerStatePluginHandler.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/server/src/HWRMPowerStatePluginHandler.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -93,11 +93,22 @@
                                                 KHWRMBatteryStatus ) );
     // Charging status
     User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
+                                               KHWRMExtendedBatteryStatus, RProperty::EInt,
+                                               KNoCapability, KHWRMSidOnlyPolicy ) );
+    User::LeaveIfError( iExtendedBattStatusProp.Attach( KPSUidHWRMPowerState,
+                                                KHWRMExtendedBatteryStatus ) );
+    // Charging status
+    User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
                                            KHWRMChargingStatus, RProperty::EInt,
                                            KNoCapability, KHWRMSidOnlyPolicy ) );
     User::LeaveIfError( iChargingStatusProp.Attach( KPSUidHWRMPowerState,
                                                     KHWRMChargingStatus ) );
-    
+    User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
+                                               KHWRMExtendedChargingStatus, RProperty::EInt,
+                                               KNoCapability, KHWRMSidOnlyPolicy ) );
+    User::LeaveIfError( iExtendedChargingStatusProp.Attach( KPSUidHWRMPowerState,
+                                                    KHWRMExtendedChargingStatus ) );
+
     // Get plugin instance
     iPlugin = CHWRMPowerStatePlugin::NewL( this );
 
@@ -140,7 +151,9 @@
     iBattLevelProp.Close();
     iBattStatusProp.Close();
     iChargingStatusProp.Close();
-
+    iExtendedBattStatusProp.Close();
+    iExtendedChargingStatusProp.Close();
+        
     COMPONENT_TRACE1(_L("HWRM Server - CHWRMPowerStatePluginHandler::~CHWRMPowerStatePluginHandler - return ") );
     }
 
@@ -163,16 +176,43 @@
             iBattLevelProp.Set( aValue );
             break;
             }
-        case KHWRMBatteryStatus:
+        case KHWRMExtendedBatteryStatus:
+        case KHWRMBatteryStatus: // Just for the sake of Integration TestCode, shall be removed once legacy things are deprecated completely
             {
-            COMPONENT_TRACE2(_L("HWRM Server - KHWRMBatteryStatus key value=%d"), aValue );
-            iBattStatusProp.Set( aValue );
+            COMPONENT_TRACE2(_L("HWRM Server - KHWRMExtendedBatteryStatus key value=%d"), aValue );
+            
+            if ( aValue == EBatteryStatusNotSupported ||
+            		 aValue == EBatteryStatusDbiAuthFailed )
+                {
+                iBattStatusProp.Set( EBatteryStatusUnknown );
+                }
+            else
+                {
+                iBattStatusProp.Set( aValue );
+                }
+                
+            iExtendedBattStatusProp.Set( aValue );
+            
             break;
-            }
-        case KHWRMChargingStatus:
+            }        
+        case KHWRMExtendedChargingStatus:
+        case KHWRMChargingStatus: // Just for the sake of Integration TestCode, shall be removed once legacy things are deprecated completely
             {
-            COMPONENT_TRACE2(_L("HWRM Server - KHWRMChargingStatus key value=%d"), aValue );
-            iChargingStatusProp.Set( aValue );                        
+            COMPONENT_TRACE2(_L("HWRM Server - KHWRMExtendedChargingStatus key value=%d"), aValue );
+                             
+            if ( aValue == EChargingStatusIllegalChargerError ||
+                 aValue == EChargingStatusChargerUnderVoltageError ||
+                 aValue == EChargingStatusChargerOverVoltageError ||
+                 aValue == EChargingStatusTempTooHotError ||
+                 aValue == EChargingStatusTempTooColdError)
+                {
+                iChargingStatusProp.Set ( EChargingStatusError );
+                }
+            else
+                {
+                iChargingStatusProp.Set( aValue );
+                }
+            
             if ( iChargerBlockVibra || iChargerBlockVibraFeedback )
                 {
                 if ( aValue == EChargingStatusCharging ||
@@ -188,6 +228,9 @@
                     RProperty::Set(KPSUidHWRMPrivate, KHWRMInternalVibraBlocked, EFalse);
                     }
                 }
+                
+            iExtendedChargingStatusProp.Set( aValue );
+            
             break;
             }
         default:
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtest.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtest.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -145,8 +145,11 @@
     ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestLightSetColorReserveL);
     
     // Power State tests
-    ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestPowerStatesL);
-	
+    ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestPowerStatesL);	
+    ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestPowerExtendedBatteryStatusL);
+    ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestPowerBatteryStatusL);
+    ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestPowerChargingStatusL);
+    
 	// Extended Lights
 	ADD_TEST_STEP_ISO_CPP(CHWRMTest, TestExtendedLightSessionsL);
 
@@ -1349,17 +1352,78 @@
 	ExecuteTestL();	
 	}
 
-
 void CHWRMTest::TestPowerStatesL()
-	{
-	INFO_PRINTF1(_L("Start test step: TestPowerStatesL"));
-	AddTestStateL(this, &CHWRMTest::PowerStateOpenL, KTwoTimeUnits);
-	AddTestStateL(this, &CHWRMTest::BatteryLevelL, KTwoTimeUnits);
-	AddTestStateL(this, &CHWRMTest::BatteryStateL, KTwoTimeUnits);
-	AddTestStateL(this, &CHWRMTest::ChargingStatusL, KTwoTimeUnits);	
-	
-	ExecuteTestL();	
-	}
+    {
+    INFO_PRINTF1(_L("Start test step: TestPowerStatesL"));
+    AddTestStateL(this, &CHWRMTest::PowerStateOpenL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectLegacyBatteryStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectLegacyChargingStatusL, KTwoTimeUnits);    
+    AddTestStateL(this, &CHWRMTest::BatteryLevelL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::BatteryStateL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusL, KTwoTimeUnits);    
+    
+    ExecuteTestL(); 
+    }
+
+void CHWRMTest::TestPowerExtendedBatteryStatusL()
+    {
+    INFO_PRINTF1(_L("Start test step: TestPowerExtendedBatteryStatusL"));
+    AddTestStateL(this, &CHWRMTest::PowerStateOpenL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectNewBatteryStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectNewChargingStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateStatusOkL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateUnknownErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateUnsupportedL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateAuthErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateStatusLowL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateStatusEmptyL, KTwoTimeUnits);    
+    // Reset battery status to "Ok"
+    AddTestStateL(this, &CHWRMTest::ExtendedBatteryStateStatusOkL, KTwoTimeUnits);
+    
+    ExecuteTestL();
+    }
+	
+void CHWRMTest::TestPowerBatteryStatusL()
+    {
+    INFO_PRINTF1(_L("Start test step: TestPowerBatteryStatusL"));
+    AddTestStateL(this, &CHWRMTest::PowerStateOpenL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectLegacyBatteryStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectLegacyChargingStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::BatteryStateStatusOkL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::BatteryStateUnknownErrorL, KTwoTimeUnits);
+		AddTestStateL(this, &CHWRMTest::BatteryStateUnsupportedL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::BatteryStateAuthErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::BatteryStateStatusLowL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::BatteryStateStatusEmptyL, KTwoTimeUnits);    
+    // Reset battery status to "Ok"
+    AddTestStateL(this, &CHWRMTest::BatteryStateStatusOkL, KTwoTimeUnits);
+    
+    ExecuteTestL();
+    }	
+
+void CHWRMTest::TestPowerChargingStatusL()
+    {
+    INFO_PRINTF1(_L("Start test step: TestPowerChargingStatusL"));
+    AddTestStateL(this, &CHWRMTest::PowerStateOpenL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectLegacyBatteryStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ExpectLegacyChargingStatusL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusNotConnectedL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusChargingOkL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusNotChargingL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusAlmostCompleteL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusCompletedChargingL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusChargingContinuesL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusIllegalErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusUnderVoltageErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusOverVoltageErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusTooHotErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::ChargingStatusTooColdErrorL, KTwoTimeUnits);
+    //Reset Charging Status to "completed"
+    AddTestStateL(this, &CHWRMTest::ChargingStatusCompletedChargingL, KTwoTimeUnits);
+    
+    ExecuteTestL();
+    }
 
 void CHWRMTest::TestExtendedLightSessionsL()
 	{
@@ -1478,10 +1542,10 @@
 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
 #define SET_CHARGINGSTATUS(s) \
 	{ \
-	iMockPowerState.CompleteL(KHWRMChargingStatus, s, 5); \
+	iMockPowerState.CompleteL(KHWRMExtendedChargingStatus, s, 5); \
 	User::After(KOneSecond); \
 	iChargingStatus = s; \
-	if(iChargingStatusCBregistered) ExpectedChargingStatusNotificationsL(s); \
+	if(iChargingStatusCBregistered) ExpectedExtendedChargingStatusNotificationsL(s); \
 	}
 
 void CHWRMTest::PowerAndPowerStateOpenL()
@@ -1510,6 +1574,36 @@
 	SET_CHARGINGSTATUS(EChargingStatusError);
 	}
 
+void CHWRMTest::PowerChargingStatusIllegalErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusIllegalErrorL"));
+    SET_CHARGINGSTATUS(EChargingStatusIllegalChargerError);
+    }
+
+void CHWRMTest::PowerChargingStatusUnderVoltageErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusUnderVoltageErrorL"));
+    SET_CHARGINGSTATUS(EChargingStatusChargerUnderVoltageError);
+    }
+
+void CHWRMTest::PowerChargingStatusOverVoltageErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusOverVoltageErrorL"));
+    SET_CHARGINGSTATUS(EChargingStatusChargerOverVoltageError);
+    }
+
+void CHWRMTest::PowerChargingStatusTooHotErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusTooHotErrorL"));
+    SET_CHARGINGSTATUS(EChargingStatusTempTooHotError);
+    }
+
+void CHWRMTest::PowerChargingStatusTooColdErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusTooColdErrorL"));
+    SET_CHARGINGSTATUS(EChargingStatusTempTooColdError);
+    }
+
 void CHWRMTest::PowerChargingStatusNotConnectedL()
 	{
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusNotConnectedL"));
@@ -1551,19 +1645,74 @@
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusError3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusError);
-		ExpectedChargingStatusNotificationsL(EChargingStatusError);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusError);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusError);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusError);
 	}
 
+void CHWRMTest::PowerChargingStatusIllegalError3L()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusIllegalError3L"));
+    if(iChargingStatusCBregistered)
+        {
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusIllegalChargerError);
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusIllegalChargerError);
+        }
+    SET_CHARGINGSTATUS(EChargingStatusIllegalChargerError);
+    }
+
+void CHWRMTest::PowerChargingStatusUnderVoltageError3L()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusUnderVoltageError3L"));
+    if(iChargingStatusCBregistered)
+        {
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargerUnderVoltageError);
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargerUnderVoltageError);
+        }
+    SET_CHARGINGSTATUS(EChargingStatusChargerUnderVoltageError);
+    }
+
+void CHWRMTest::PowerChargingStatusOverVoltageError3L()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusOverVoltageError3L"));
+    if(iChargingStatusCBregistered)
+        {
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargerOverVoltageError);
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargerOverVoltageError);
+        }    
+    SET_CHARGINGSTATUS(EChargingStatusChargerOverVoltageError);
+    }
+
+void CHWRMTest::PowerChargingStatusTooHotError3L()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusTooHotError3L"));
+    if(iChargingStatusCBregistered)
+        {
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusTempTooHotError);
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusTempTooHotError);
+        }   
+    SET_CHARGINGSTATUS(EChargingStatusTempTooHotError);
+    }
+
+void CHWRMTest::PowerChargingStatusTooColdError3L()
+    {
+    INFO_PRINTF1(_L("Step state: PowerChargingStatusTooColdError3L"));
+    if(iChargingStatusCBregistered)
+        {
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusTempTooColdError);
+        ExpectedExtendedChargingStatusNotificationsL(EChargingStatusTempTooColdError);
+        }
+    SET_CHARGINGSTATUS(EChargingStatusTempTooColdError);
+    }
+
 void CHWRMTest::PowerChargingStatusNotConnected3L()
 	{
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusNotConnected3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusNotConnected);
-		ExpectedChargingStatusNotificationsL(EChargingStatusNotConnected);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusNotConnected);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusNotConnected);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusNotConnected);
 	}
@@ -1573,8 +1722,8 @@
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusCharging3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusCharging);
-		ExpectedChargingStatusNotificationsL(EChargingStatusCharging);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusCharging);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusCharging);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusCharging);
 	}
@@ -1584,8 +1733,8 @@
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusNotCharging3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusNotCharging);
-		ExpectedChargingStatusNotificationsL(EChargingStatusNotCharging);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusNotCharging);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusNotCharging);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusNotCharging);
 	}
@@ -1595,8 +1744,8 @@
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusAlmostComplete3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusAlmostComplete);
-		ExpectedChargingStatusNotificationsL(EChargingStatusAlmostComplete);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusAlmostComplete);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusAlmostComplete);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusAlmostComplete);
 	}
@@ -1606,8 +1755,8 @@
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusComplete3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusChargingComplete);
-		ExpectedChargingStatusNotificationsL(EChargingStatusChargingComplete);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargingComplete);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargingComplete);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusChargingComplete);
 	}
@@ -1617,8 +1766,8 @@
 	INFO_PRINTF1(_L("Step state: PowerChargingStatusContinued3L"));
 	if(iChargingStatusCBregistered)
 		{
-		ExpectedChargingStatusNotificationsL(EChargingStatusChargingContinued);
-		ExpectedChargingStatusNotificationsL(EChargingStatusChargingContinued);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargingContinued);
+		ExpectedExtendedChargingStatusNotificationsL(EChargingStatusChargingContinued);
 		}
 	SET_CHARGINGSTATUS(EChargingStatusChargingContinued);
 	}
@@ -2348,6 +2497,72 @@
 	TestBatteryChargerTypeMultiClientL((TInt)CHWRMPower::EBatteryChargerUsbDedicated);
 	}
 
+void CHWRMTest::GetBatteryChargerTypeUSBHispeedHost()
+    {
+    INFO_PRINTF1(_L("Step state: GetBatteryChargerTypeUSBHispeedHost"));
+    
+    CHWRMPower& power = GetPowerSessionWithCallbackRegisteredL();
+    
+    RMockPower& mockPower = GetMockPower();
+
+    TBuf8<1> emptyDes;
+    mockPower.ExpectProcessCmdL(HWRMPowerCommand::EGetBatteryChargerTypeCmdId, emptyDes);
+
+    HWRMPowerCommand::TBatteryChargerTypeData responsedata;
+    responsedata.iErrorCode = KErrNone;
+    responsedata.iChargerType = HWRMPowerCommand::EBatteryChargerUsbHispeedHost;
+
+    HWRMPowerCommand::TBatteryChargerTypeResponsePackage response(responsedata);
+    mockPower.CompleteL(HWRMPowerCommand::EGetBatteryChargerTypeCmdId, 2, response);
+    
+    CHWRMPower::TBatteryChargerType data;
+    User::LeaveIfError(power.GetBatteryChargerType(data));
+
+    if( data != CHWRMPower::EBatteryChargerUsbHispeedHost )
+        {
+        User::Leave(KErrGeneral);
+        }
+    }
+
+void CHWRMTest::GetBatteryChargerTypeUSBHispeedHostMulticlientL()
+    {
+    INFO_PRINTF1(_L("Step state: GetBatteryChargerTypeUSBHispeedHostMulticlientL"));
+    TestBatteryChargerTypeMultiClientL((TInt)CHWRMPower::EBatteryChargerUsbHispeedHost);
+    }
+
+void CHWRMTest::GetBatteryChargerTypeUSBAca()
+    {
+    INFO_PRINTF1(_L("Step state: GetBatteryChargerTypeUSBAca"));
+    
+    CHWRMPower& power = GetPowerSessionWithCallbackRegisteredL();
+    
+    RMockPower& mockPower = GetMockPower();
+
+    TBuf8<1> emptyDes;
+    mockPower.ExpectProcessCmdL(HWRMPowerCommand::EGetBatteryChargerTypeCmdId, emptyDes);
+
+    HWRMPowerCommand::TBatteryChargerTypeData responsedata;
+    responsedata.iErrorCode = KErrNone;
+    responsedata.iChargerType = HWRMPowerCommand::EBatteryChargerUsbAca;
+
+    HWRMPowerCommand::TBatteryChargerTypeResponsePackage response(responsedata);
+    mockPower.CompleteL(HWRMPowerCommand::EGetBatteryChargerTypeCmdId, 2, response);
+    
+    CHWRMPower::TBatteryChargerType data;
+    User::LeaveIfError(power.GetBatteryChargerType(data));
+
+    if( data != CHWRMPower::EBatteryChargerUsbAca )
+        {
+        User::Leave(KErrGeneral);
+        }
+    }
+
+void CHWRMTest::GetBatteryChargerTypeUSBAcaMulticlientL()
+    {
+    INFO_PRINTF1(_L("Step state: GetBatteryChargerTypeUSBAcaMulticlientL"));
+    TestBatteryChargerTypeMultiClientL((TInt)CHWRMPower::EBatteryChargerUsbAca);
+    }
+
 void CHWRMTest::GetBatteryChargerTypeWithPluginErrorL()
 	{
 	INFO_PRINTF1(_L("Step state: GetBatteryChargerTypeWithPluginErrorL"));
@@ -2509,6 +2724,11 @@
 	AddTestStateL(this, &CHWRMTest::RegisterChargingStatusCallbackL, KOneTimeUnit);
 	
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusIllegalErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusUnderVoltageErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusOverVoltageErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooHotErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooColdErrorL, KTwoTimeUnits);	
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusNotConnectedL, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusChargingL, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusNotChargingL, KTwoTimeUnits);
@@ -2532,6 +2752,11 @@
 	AddTestStateL(this, &CHWRMTest::RegisterChargingStatusCallbackMultiClient3L, KOneTimeUnit);
 	
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusError3L, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusIllegalError3L, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusUnderVoltageError3L, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusOverVoltageError3L, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooHotError3L, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooColdError3L, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusNotConnected3L, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusCharging3L, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusNotCharging3L, KTwoTimeUnits);
@@ -2617,6 +2842,21 @@
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusErrorL, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::StartRemainingChargingTimeErrorL, KTwoTimeUnits);
 	
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusIllegalErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartRemainingChargingTimeErrorL, KTwoTimeUnits);
+        
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusOverVoltageErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartRemainingChargingTimeErrorL, KTwoTimeUnits);
+    
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusUnderVoltageErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartRemainingChargingTimeErrorL, KTwoTimeUnits);
+    
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooHotErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartRemainingChargingTimeErrorL, KTwoTimeUnits);
+        
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooColdErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartRemainingChargingTimeErrorL, KTwoTimeUnits);
+	
 	ExecuteTestL();
 	}
 
@@ -2797,6 +3037,21 @@
 	AddTestStateL(this, &CHWRMTest::PowerChargingStatusErrorL, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::StartChargingCurrentErrorL, KTwoTimeUnits);
 	
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusIllegalErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::StartChargingCurrentErrorL, KTwoTimeUnits);
+	    
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusOverVoltageErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::StartChargingCurrentErrorL, KTwoTimeUnits);
+	
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusUnderVoltageErrorL, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::StartChargingCurrentErrorL, KTwoTimeUnits);
+	
+	AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooHotErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartChargingCurrentErrorL, KTwoTimeUnits);
+	    
+    AddTestStateL(this, &CHWRMTest::PowerChargingStatusTooColdErrorL, KTwoTimeUnits);
+    AddTestStateL(this, &CHWRMTest::StartChargingCurrentErrorL, KTwoTimeUnits);
+	        
 	ExecuteTestL();
 	}
 
@@ -2971,7 +3226,9 @@
 	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeNoCharger, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeACMain, KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeUSB, KTwoTimeUnits);
-
+	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeUSBHispeedHost, KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeUSBAca, KTwoTimeUnits);
+	
 	ExecuteTestL();
 	}
 
@@ -2984,7 +3241,9 @@
 	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeNoChargerMulticlientL, 2*KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeACMainMulticlientL, 2*KTwoTimeUnits);
 	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeUSBMulticlientL, 2*KTwoTimeUnits);
-
+	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeUSBHispeedHostMulticlientL, 2*KTwoTimeUnits);
+	AddTestStateL(this, &CHWRMTest::GetBatteryChargerTypeUSBAcaMulticlientL, 2*KTwoTimeUnits);
+	
 	ExecuteTestL();
 	}
 
@@ -4413,6 +4672,34 @@
 	OpenPowerStateSessionL();		
 	}
 
+void CHWRMTest::ExpectLegacyBatteryStatusL()
+    {
+    delete iExtendedBatteryStatusObserver;
+    iExtendedBatteryStatusObserver = NULL;
+    iExpectedExtendedBatteryStatusNotifications.Reset();
+    }
+
+void CHWRMTest::ExpectLegacyChargingStatusL()
+    {
+    delete iExtendedChargingStatusObserver;
+    iExtendedChargingStatusObserver = NULL;
+    iExpectedExtendedChargingStatusNotifications.Reset();
+    }
+
+void CHWRMTest::ExpectNewBatteryStatusL()
+    {
+    delete iBatteryStatusObserver;
+    iBatteryStatusObserver = NULL;
+    iExpectedBatteryStatusNotifications.Reset();
+    }
+
+void CHWRMTest::ExpectNewChargingStatusL()
+    {
+    delete iChargingStatusObserver;
+    iChargingStatusObserver = NULL;
+    iExpectedChargingStatusNotifications.Reset();
+    }
+
 void CHWRMTest::BatteryLevelL()
 	{
 	INFO_PRINTF1(_L("Step state: BatteryLevelL"));
@@ -4433,6 +4720,128 @@
 	User::After(KOneSecond);
 	
 	}
+	
+// Pump New Values from MockServer and test the legacy keys
+void CHWRMTest::BatteryStateUnknownErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: BatteryStateUnknownErrorL"));
+     
+    ExpectBatteryStatusNotificationL(EBatteryStatusUnknown);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMBatteryStatus,EBatteryStatusUnknown,delay);
+    User::After(KOneSecond);    
+    }
+	
+void CHWRMTest::BatteryStateUnsupportedL()
+    {
+    INFO_PRINTF1(_L("Step state: BatteryStateUnsupportedL"));
+     
+    ExpectBatteryStatusNotificationL(EBatteryStatusUnknown);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMBatteryStatus,EBatteryStatusNotSupported,delay);
+    User::After(KOneSecond);    
+    }	
+
+void CHWRMTest::BatteryStateAuthErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: BatteryStateAuthErrorL"));
+    
+    ExpectBatteryStatusNotificationL(EBatteryStatusUnknown);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMBatteryStatus,EBatteryStatusDbiAuthFailed,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::BatteryStateStatusOkL()
+    {
+    INFO_PRINTF1(_L("Step state: BatteryStateStatusOkL"));
+        
+    ExpectBatteryStatusNotificationL(EBatteryStatusOk);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMBatteryStatus,EBatteryStatusOk,delay);
+    User::After(KOneSecond);    
+    }
+
+void CHWRMTest::BatteryStateStatusLowL()
+    {
+    INFO_PRINTF1(_L("Step state: BatteryStateStatusLowL"));
+    
+    ExpectBatteryStatusNotificationL(EBatteryStatusLow);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMBatteryStatus,EBatteryStatusLow,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::BatteryStateStatusEmptyL()
+    {
+    INFO_PRINTF1(_L("Step state: BatteryStateStatusEmptyL"));
+    
+    ExpectBatteryStatusNotificationL(EBatteryStatusEmpty);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMBatteryStatus,EBatteryStatusEmpty,delay);
+    User::After(KOneSecond);
+    }	
+			
+// Pump New Values from MockServer and test the extended keys
+void CHWRMTest::ExtendedBatteryStateUnknownErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ExtendedBatteryStateUnknownErrorL"));
+     
+    ExpectExtendedBatteryStatusNotificationL(EBatteryStatusUnknown);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMExtendedBatteryStatus,EBatteryStatusUnknown,delay);
+    User::After(KOneSecond);    
+    }
+
+void CHWRMTest::ExtendedBatteryStateUnsupportedL()
+    {
+    INFO_PRINTF1(_L("Step state: ExtendedBatteryStateUnsupportedL"));
+     
+    ExpectExtendedBatteryStatusNotificationL(EBatteryStatusNotSupported);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMExtendedBatteryStatus,EBatteryStatusNotSupported,delay);
+    User::After(KOneSecond);    
+    }
+	
+void CHWRMTest::ExtendedBatteryStateAuthErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ExtendedBatteryStateAuthErrorL"));
+    
+    ExpectExtendedBatteryStatusNotificationL(EBatteryStatusDbiAuthFailed);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMExtendedBatteryStatus,EBatteryStatusDbiAuthFailed,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ExtendedBatteryStateStatusOkL()
+    {
+    INFO_PRINTF1(_L("Step state: ExtendedBatteryStateStatusOkL"));
+        
+    ExpectExtendedBatteryStatusNotificationL(EBatteryStatusOk);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMExtendedBatteryStatus,EBatteryStatusOk,delay);
+    User::After(KOneSecond);    
+    }
+
+void CHWRMTest::ExtendedBatteryStateStatusLowL()
+    {
+    INFO_PRINTF1(_L("Step state: ExtendedBatteryStateStatusLowL"));
+    
+    ExpectExtendedBatteryStatusNotificationL(EBatteryStatusLow);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMExtendedBatteryStatus,EBatteryStatusLow,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ExtendedBatteryStateStatusEmptyL()
+    {
+    INFO_PRINTF1(_L("Step state: ExtendedBatteryStateStatusEmptyL"));
+    
+    ExpectExtendedBatteryStatusNotificationL(EBatteryStatusEmpty);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMExtendedBatteryStatus,EBatteryStatusEmpty,delay);
+    User::After(KOneSecond);
+    }
 
 void CHWRMTest::ChargingStatusL()
 	{
@@ -4444,6 +4853,127 @@
 	User::After(KOneSecond);
 	
 	}
+
+void CHWRMTest::ChargingStatusNotConnectedL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusNotConnectedL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusNotConnected);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusNotConnected,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusChargingOkL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusChargingOkL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusCharging);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusCharging,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusNotChargingL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusNotChargingL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusNotCharging);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusNotCharging,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusAlmostCompleteL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusAlmostCompleteL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusAlmostComplete);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusAlmostComplete,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusCompletedChargingL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusCompletedChargingL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusChargingComplete);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusChargingComplete,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusChargingContinuesL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusChargingContinuesL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusChargingContinued);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusChargingContinued,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusErrorL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusError);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusError,delay);
+    User::After(KOneSecond);
+    }
+
+// Below API's publishes new Charging States and expects mapped states using the legacy P&S key
+void CHWRMTest::ChargingStatusIllegalErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusIllegalErrorL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusError);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusIllegalChargerError,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusUnderVoltageErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusUnderVoltageL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusError);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusChargerUnderVoltageError,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusOverVoltageErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusOverVoltageL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusError);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusChargerOverVoltageError,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusTooHotErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusTooHotErrorL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusError);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusTempTooHotError,delay);
+    User::After(KOneSecond);
+    }
+
+void CHWRMTest::ChargingStatusTooColdErrorL()
+    {
+    INFO_PRINTF1(_L("Step state: ChargingStatusTooColdErrorL"));
+    
+    ExpectedChargingStatusNotificationsL(EChargingStatusError);
+    TInt delay(5);
+    iMockPowerState.CompleteL(KHWRMChargingStatus,EChargingStatusTempTooColdError,delay);
+    User::After(KOneSecond);
+    }
 	
 void CHWRMTest::VibraOpenL()
 	{
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtest.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtest.h	Mon Oct 04 02:28:24 2010 +0300
@@ -122,6 +122,9 @@
 	
 	// Power State tests
 	void TestPowerStatesL();
+	void TestPowerExtendedBatteryStatusL();
+	void TestPowerBatteryStatusL();
+	void TestPowerChargingStatusL();
 	
 	// Extended Lights
 	void TestExtendedLightSessionsL();
@@ -458,9 +461,37 @@
 	void OpenFlipL();
 		
 	void PowerStateOpenL();
+	void ExpectLegacyBatteryStatusL();
+    void ExpectLegacyChargingStatusL();
+    void ExpectNewBatteryStatusL();
+    void ExpectNewChargingStatusL();
 	void BatteryLevelL();
 	void BatteryStateL();
-	void ChargingStatusL();	
+	void BatteryStateUnknownErrorL();
+	void BatteryStateUnsupportedL();
+	void BatteryStateAuthErrorL();
+	void BatteryStateStatusOkL();
+	void BatteryStateStatusLowL();
+	void BatteryStateStatusEmptyL();
+	void ExtendedBatteryStateUnknownErrorL();
+	void ExtendedBatteryStateUnsupportedL();
+	void ExtendedBatteryStateAuthErrorL();
+	void ExtendedBatteryStateStatusOkL();
+	void ExtendedBatteryStateStatusLowL();
+	void ExtendedBatteryStateStatusEmptyL();
+	void ChargingStatusL();
+	void ChargingStatusNotConnectedL();
+	void ChargingStatusChargingOkL();
+	void ChargingStatusNotChargingL();
+	void ChargingStatusAlmostCompleteL();
+	void ChargingStatusCompletedChargingL();
+	void ChargingStatusChargingContinuesL();
+	void ChargingStatusErrorL();
+	void ChargingStatusIllegalErrorL();
+	void ChargingStatusUnderVoltageErrorL();
+	void ChargingStatusOverVoltageErrorL();
+	void ChargingStatusTooHotErrorL();
+	void ChargingStatusTooColdErrorL();
 
 	void DisableNotificationCheckingL();
 	void EnableNotificationCheckingL();
@@ -495,6 +526,11 @@
 	void PowerAndPowerStateOpenL();
 	void PowerAndPowerState3SessionsOpenL();
 	void PowerChargingStatusErrorL();
+	void PowerChargingStatusIllegalErrorL();
+	void PowerChargingStatusUnderVoltageErrorL();
+	void PowerChargingStatusOverVoltageErrorL();
+	void PowerChargingStatusTooHotErrorL();
+	void PowerChargingStatusTooColdErrorL();	
 	void PowerChargingStatusNotConnectedL();
 	void PowerChargingStatusChargingL();
 	void PowerChargingStatusNotChargingL();
@@ -502,6 +538,11 @@
 	void PowerChargingStatusCompleteL();	
 	void PowerChargingStatusContinuedL();	
 	void PowerChargingStatusError3L();
+	void PowerChargingStatusIllegalError3L();
+	void PowerChargingStatusUnderVoltageError3L();
+	void PowerChargingStatusOverVoltageError3L();
+	void PowerChargingStatusTooHotError3L();
+	void PowerChargingStatusTooColdError3L();	
 	void PowerChargingStatusNotConnected3L();
 	void PowerChargingStatusCharging3L();
 	void PowerChargingStatusNotCharging3L();
@@ -551,6 +592,10 @@
 	void GetBatteryChargerTypeNoChargerMulticlientL();
 	void GetBatteryChargerTypeACMainMulticlientL();
 	void GetBatteryChargerTypeUSBMulticlientL();
+	void GetBatteryChargerTypeUSBHispeedHost();
+	void GetBatteryChargerTypeUSBHispeedHostMulticlientL();
+	void GetBatteryChargerTypeUSBAca();
+	void GetBatteryChargerTypeUSBAcaMulticlientL();	
 	void GetBatteryChargerTypeWithPluginErrorL();
 	void ChargingCurrentMaxPeriodReachedL();
 	void StartChargingCurrentSameIntervalL();
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtestbase.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtestbase.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -197,7 +197,9 @@
 	
 	iBatteryLevelObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMBatteryLevel,*this);
 	iBatteryStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMBatteryStatus,*this);
+	iExtendedBatteryStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMExtendedBatteryStatus,*this);
 	iChargingStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMChargingStatus,*this);
+	iExtendedChargingStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMExtendedChargingStatus,*this);
 	}
 
 void CHWRMTestBase::CleanupPropertyObservers()
@@ -205,9 +207,13 @@
 	delete iBatteryLevelObserver;
 	iBatteryLevelObserver = NULL;
 	delete iBatteryStatusObserver;
-	iBatteryLevelObserver = NULL;
+	iBatteryStatusObserver = NULL;
+	delete iExtendedBatteryStatusObserver;
+	iExtendedBatteryStatusObserver = NULL;
 	delete iChargingStatusObserver;
-	iBatteryLevelObserver = NULL;	
+	iChargingStatusObserver = NULL;
+	delete iExtendedChargingStatusObserver;
+	iExtendedChargingStatusObserver = NULL;
 	}
 
 void CHWRMTestBase::GetCRVibraAttributeL(TUint32 aVibraKey, TInt &aValue)
@@ -364,10 +370,20 @@
 	iExpectedBatteryStatusNotifications.AppendL(aStatus);
 	}
 
+void CHWRMTestBase::ExpectExtendedBatteryStatusNotificationL(EPSHWRMBatteryStatus aStatus)
+    {
+    iExpectedExtendedBatteryStatusNotifications.AppendL(aStatus);
+    }
+
 void CHWRMTestBase::ExpectedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus)
 	{
 	iExpectedChargingStatusNotifications.AppendL(aStatus);
 	}
+
+void CHWRMTestBase::ExpectedExtendedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus)
+    {
+    iExpectedExtendedChargingStatusNotifications.AppendL(aStatus);
+    }
 	
 void CHWRMTestBase::ExpectVibraStatusNotificationL(CHWRMVibra::TVibraStatus aStatus)
 	{
@@ -741,8 +757,14 @@
 		BatteryStatusChanged(aValue);
 		break;
 	case KHWRMChargingStatus:
-		ChargingStatusChanged(aValue);
-		break;
+        ChargingStatusChanged(aValue);
+        break;
+	case KHWRMExtendedBatteryStatus:
+	    ExtendedBatteryStatusChanged(aValue);
+	    break;	
+	case KHWRMExtendedChargingStatus:
+        ExtendedChargingStatusChanged(aValue);
+        break;		
 	default:
 		break;
   		}
@@ -786,13 +808,32 @@
     CheckForEndOfTransition();
  	}
  
+ void CHWRMTestBase::ExtendedBatteryStatusChanged(TInt aBatteryStatus)
+    {
+    if (iExpectedExtendedBatteryStatusNotifications.Count() > 0)
+        {
+        if (aBatteryStatus != iExpectedExtendedBatteryStatusNotifications[0])
+            {
+            INFO_PRINTF3(_L("### ERROR: ExtendedBatteryStatusChanged, expected:%d, actual:%d"),iExpectedExtendedBatteryStatusNotifications[0],aBatteryStatus);
+            SetTestFail();
+            }
+        iExpectedExtendedBatteryStatusNotifications.Remove(0);
+        }
+    else
+        {
+        INFO_PRINTF2(_L("### ERROR: ExtendedBatteryStatusChanged, expected:NONE, actual:%d"),aBatteryStatus);
+        SetTestFail();
+        }
+    CheckForEndOfTransition();
+    }
+
   void CHWRMTestBase::ChargingStatusChanged(TInt aChargingStatus)
 	{
   	if (iExpectedChargingStatusNotifications.Count() > 0)
   		{
   		if (aChargingStatus != iExpectedChargingStatusNotifications[0])
   			{
-	  		INFO_PRINTF3(_L("### ERROR: BatteryStatusChanged, expected:%d, actual:%d"),iExpectedChargingStatusNotifications[0],aChargingStatus);
+	  		INFO_PRINTF3(_L("### ERROR: ChargingStatusChanged, expected:%d, actual:%d"),iExpectedChargingStatusNotifications[0],aChargingStatus);
 	  		SetTestFail();
   			}
         iExpectedChargingStatusNotifications.Remove(0);
@@ -804,7 +845,26 @@
  		}
     CheckForEndOfTransition();
  	}
- 	
+
+  void CHWRMTestBase::ExtendedChargingStatusChanged(TInt aChargingStatus)
+    {
+    if (iExpectedExtendedChargingStatusNotifications.Count() > 0)
+        {
+        if (aChargingStatus != iExpectedExtendedChargingStatusNotifications[0])
+            {
+            INFO_PRINTF3(_L("### ERROR: ExtendedChargingStatusChanged, expected:%d, actual:%d"),iExpectedExtendedChargingStatusNotifications[0],aChargingStatus);
+            SetTestFail();
+            }
+        iExpectedExtendedChargingStatusNotifications.Remove(0);
+        }
+    else
+        {
+        INFO_PRINTF2(_L("### ERROR: ExtendedChargingStatusChanged, expected:NONE, actual:%d"),aChargingStatus);
+        SetTestFail();
+        }
+    CheckForEndOfTransition();
+    }
+  
 void CHWRMTestBase::CheckPluginInsensitivity()
 	{
 	TInt value;
@@ -891,7 +951,9 @@
 		|| 	iExpectedLightNotifications.Count() 				!=0
 		|| 	iExpectedBatteryLevelNotifications.Count()			!=0
 		|| 	iExpectedBatteryStatusNotifications.Count()			!=0
+		||  iExpectedExtendedBatteryStatusNotifications.Count() !=0
 		|| 	iExpectedChargingStatusNotifications.Count()		!=0
+        ||  iExpectedExtendedChargingStatusNotifications.Count()!=0
 		||  iExpectedBatteryPowerMeasurementsError.Count()		!=0
 		||  iExpectedFmTxStatusNotifications.Count() 			!=0
 		||  iExpectedFmTxFrequencyNotifications.Count()			!=0
@@ -1134,7 +1196,9 @@
 	iExpectedFmTxFrequencyNotifications.Close();
 	iExpectedBatteryLevelNotifications.Close();
 	iExpectedBatteryStatusNotifications.Close();
+	iExpectedExtendedBatteryStatusNotifications.Close();
 	iExpectedChargingStatusNotifications.Close();
+	iExpectedExtendedChargingStatusNotifications.Close();
 	iExpectedVibraFeedbackModeNotifications.Close();
 	iExpectedBatteryPowerMeasurementsError.Close();
 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
@@ -1281,11 +1345,21 @@
 		SetTestFail();
 		INFO_PRINTF1(_L("### ERROR Expected Battery Status Notification not received"));
 		}
+	if (iExpectedExtendedBatteryStatusNotifications.Count() != 0)
+        {
+        SetTestFail();
+        INFO_PRINTF1(_L("### ERROR Expected Extended Battery Status Notification not received"));
+        }
 	if (iExpectedChargingStatusNotifications.Count() != 0)
 		{
 		SetTestFail();
 		INFO_PRINTF1(_L("### ERROR Expected Charging Status Notification not received"));
 		}
+	if (iExpectedExtendedChargingStatusNotifications.Count() != 0)
+        {
+        SetTestFail();
+        INFO_PRINTF1(_L("### ERROR Expected Extended Charging Status Notification not received"));
+        }
 	if (iExpectedBatteryPowerMeasurementsError.Count() != 0)
 		{
 		SetTestFail();
@@ -1461,6 +1535,31 @@
 				INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusError"));
 				break;
 				}
+			case EChargingStatusIllegalChargerError:
+                {
+                INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusIllegalChargerError"));
+                break;
+                }
+            case EChargingStatusChargerUnderVoltageError:
+                {
+                INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusChargerUnderVoltageError"));
+                break;
+                }
+            case EChargingStatusChargerOverVoltageError:
+                {
+                INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusChargerOverVoltageError"));
+                break;
+                }
+            case EChargingStatusTempTooHotError:
+                {
+                INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusTempTooHotError"));
+                break;
+                }
+            case EChargingStatusTempTooColdError:
+                {
+                INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusTempTooColdError"));
+                break;
+                }
 			case EChargingStatusNotConnected:
 				{
 				INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusNotConnected"));
@@ -1497,14 +1596,14 @@
 				}
 			}
 		
-		if (iExpectedChargingStatusNotifications.Count() > 0)
+		if (iExpectedExtendedChargingStatusNotifications.Count() > 0)
 			{
-			if (aChrgStatus != iExpectedChargingStatusNotifications[0])
+			if (aChrgStatus != iExpectedExtendedChargingStatusNotifications[0])
 				{
-				INFO_PRINTF3(_L("### ERROR: ChargingStatusChange, expected:%d, actual:%d"),iExpectedChargingStatusNotifications[0],aChrgStatus);
+				INFO_PRINTF3(_L("### ERROR: ChargingStatusChange, expected:%d, actual:%d"),iExpectedExtendedChargingStatusNotifications[0],aChrgStatus);
 				SetTestFail();
 				}
-			iExpectedChargingStatusNotifications.Remove(0);
+			iExpectedExtendedChargingStatusNotifications.Remove(0);
 			}
 		else
 			{
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtestbase.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/hwrmtestbase.h	Mon Oct 04 02:28:24 2010 +0300
@@ -167,9 +167,10 @@
 	
 	void ExpectBatteryLevelNotificationL(EPSHWRMBatteryLevel aBatteryLevel);
 	void ExpectBatteryStatusNotificationL(EPSHWRMBatteryStatus aStatus);
+	void ExpectExtendedBatteryStatusNotificationL(EPSHWRMBatteryStatus aStatus);
 	void ExpectedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus);
-	
-	void ExpectBatteryPowerMeasurementsErrorL(TInt aErrorCode);
+	void ExpectedExtendedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus);
+	void ExpectBatteryPowerMeasurementsErrorL(TInt aErrorCode);	
 	
 	// TO DO: temp solution, need to add counters
 	void CheckPluginInsensitivity();
@@ -185,7 +186,9 @@
 	void CleanupPropertyObservers();
 	void BatteryLevelChanged(TInt aBatteryLevel);
 	void BatteryStatusChanged(TInt aBatteryStatus);
+	void ExtendedBatteryStatusChanged(TInt aBatteryStatus);
 	void ChargingStatusChanged(TInt aChargingStatus);
+	void ExtendedChargingStatusChanged(TInt aChargingStatus);
 	
 	const TDesC& MapVibraModeState(CHWRMVibra::TVibraModeState aState);
 	const TDesC& MapVibraModeStatus(CHWRMVibra::TVibraStatus aStatus);
@@ -251,7 +254,9 @@
     RArray<CHWRMVibra::TVibraFeedbackModeState>	iExpectedVibraFeedbackModeNotifications;
 	RArray<EPSHWRMBatteryLevel> iExpectedBatteryLevelNotifications;
 	RArray<EPSHWRMBatteryStatus> iExpectedBatteryStatusNotifications;
+	RArray<EPSHWRMBatteryStatus> iExpectedExtendedBatteryStatusNotifications;
 	RArray<EPSHWRMChargingStatus> iExpectedChargingStatusNotifications;
+	RArray<EPSHWRMChargingStatus> iExpectedExtendedChargingStatusNotifications;
 	RArray<TInt> iExpectedBatteryPowerMeasurementsError;
 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
 	RArray<TInt> iExpectedBatteryChargingTimeMeasurementsError;
@@ -316,7 +321,9 @@
 	// P&S property observers
 	CPsPropertyObserver* iBatteryLevelObserver;
 	CPsPropertyObserver* iBatteryStatusObserver;
+	CPsPropertyObserver* iExtendedBatteryStatusObserver;
 	CPsPropertyObserver* iChargingStatusObserver;
+	CPsPropertyObserver* iExtendedChargingStatusObserver;
 	
 	TBool iTearingDown;
 	TBool iIgnoreStatusNotifications;
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_fmtx.script	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_fmtx.script	Mon Oct 04 02:28:24 2010 +0300
@@ -401,7 +401,7 @@
 //!@SYMTestActions Open a FmTx session, enable,  set Audio Routing ON, set Audio Routing OFF, check that the power save state changes after the max period of innactivity is reached, and check the power save state after the accessory is connected.
 //!@SYMTestExpectedResults Pass
 //!@SYMTestType CT
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestFmTxPowerSaveOnInactivityStateL
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestFmTxPowerSaveOnInactivityStateL
 END_TESTCASE DEVSRVS-HWRM-F-0035
 
 START_TESTCASE DEVSRVS-HWRM-F-0036
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_light.script	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_light.script	Mon Oct 04 02:28:24 2010 +0300
@@ -253,7 +253,7 @@
 //!  2. Call the new API to set the default color for the supported targets
 //!@SYMTestExpectedResults Check the API does not leave and passes the request to adaptation.
 //!@SYMTestType CT
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestLightDefaultColorL
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestLightDefaultColorL
 END_TESTCASE DEVSRVS-HWRM-L-0021
 
 START_TESTCASE DEVSRVS-HWRM-L-0022
@@ -336,7 +336,7 @@
 //!@SYMTestActions Checks that the system switches to the proper state of the RGB color setting for multi client sessions
 //!@SYMTestExpectedResults Pass
 //!@SYMTestType CT
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestLightColor_MultiClientL
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestLightColor_MultiClientL
 END_TESTCASE DEVSRVS-HWRM-L-0027
 
 START_TESTCASE DEVSRVS-HWRM-L-0028
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_power.script	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_power.script	Mon Oct 04 02:28:24 2010 +0300
@@ -529,4 +529,38 @@
 //!@SYMTestType CT
 RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerNotify_All_AdjustReportingPeriod_NegativeValueL
 END_TESTCASE DEVSRVS-HWRM-P-0033
+
+START_TESTCASE DEVSRVS-HWRM-B-0034
+//!@SYMTestCaseID DEVSRVS-HWRM-B-0034
+//!@SYMComponent telephony_hwrm
+//!@SYMTestCaseDesc Checking all extended battery states
+//!@SYMTestPriority High
+//!@SYMTestActions open power state sessions and check extended battery states 
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerExtendedBatteryStatusL
+END_TESTCASE DEVSRVS-HWRM-B-0034
+
+START_TESTCASE DEVSRVS-HWRM-B-0035
+//!@SYMTestCaseID DEVSRVS-HWRM-B-0035
+//!@SYMComponent telephony_hwrm
+//!@SYMTestCaseDesc Checking all battery states
+//!@SYMTestPriority High
+//!@SYMTestActions open power state sessions and check legacy battery states, also checks new states are mapped and states recieved correctly
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerBatteryStatusL
+END_TESTCASE DEVSRVS-HWRM-B-0035
+
+START_TESTCASE DEVSRVS-HWRM-B-0036
+//!@SYMTestCaseID DEVSRVS-HWRM-B-0036
+//!@SYMComponent telephony_hwrm
+//!@SYMTestCaseDesc Checking all charging states
+//!@SYMTestPriority High
+//!@SYMTestActions open power state sessions and check legacy charging states, also checks new states are mapped and states recieved correctly
+//!@SYMTestExpectedResults Pass
+//!@SYMTestType CT
+RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingStatusL
+END_TESTCASE DEVSRVS-HWRM-B-0036
+
 PRINT Completed te_hwrm_power tests
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_power_ext_charging_info.script	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_power_ext_charging_info.script	Mon Oct 04 02:28:24 2010 +0300
@@ -285,10 +285,10 @@
 //!                5. After some time delay change the charging state to 'disconnected'
 //!@SYMTestExpectedResults Check the battery charging current notification stopped after the step 5, the callback receives the error code KErrNotReady.
 //!@SYMTestType CT
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenChargingCompleteL
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenDisconnectedL
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenChargingComplete3L
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenDisconnected3L
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenChargingCompleteL
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenDisconnectedL
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenChargingComplete3L
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestPowerChargingCurrentNotificationWhenDisconnected3L
 END_TESTCASE DEVSRVS-HWRM-P-CHRG-0016
 
 START_TESTCASE DEVSRVS-HWRM-P-CHRG-0017
--- a/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_vibra.script	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwresourcesmgr/test/te_hwrm/te_hwrm_vibra.script	Mon Oct 04 02:28:24 2010 +0300
@@ -170,7 +170,7 @@
 //!@SYMTestActions Attempt to start vibra with duration more than max duration and taking a negative value as duration, both return error in arguments
 //!@SYMTestExpectedResults Pass
 //!@SYMTestType CT
-RUN_TEST_STEP 100 te_hwrm TEFUnit.CHWRMTest.TestVibraOnWithDurationOutOfRangeL
+RUN_TEST_STEP 200 te_hwrm TEFUnit.CHWRMTest.TestVibraOnWithDurationOutOfRangeL
 END_TESTCASE DEVSRVS-HWRM-V-0014
 
 START_TESTCASE DEVSRVS-HWRM-V-0015
--- a/resourcemgmt/hwrmtargetmodifierplugin/tsrc/hwrmtargetmodifierplugintest/group/hwrmtargetmodifierplugintest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/resourcemgmt/hwrmtargetmodifierplugin/tsrc/hwrmtargetmodifierplugintest/group/hwrmtargetmodifierplugintest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  ?Description
-*  %version:  bh1dsgas#5 %, % date_modified: % by %derived_by: sarakuma %
+*  %version:  bh1dsgas#6 %, % date_modified: % by %derived_by: deepmish %
 *
 */
 
@@ -36,6 +36,6 @@
 
 LIBRARY     euser.lib
 LIBRARY     ecom.lib
-LIBRARY     stiftestinterface.lib
+LIBRARY     StifTestInterface.lib
 
 SMPSAFE
--- a/sensorservices/orientationssy/data/10282F0F.RSS	Fri Sep 17 08:36:42 2010 +0300
+++ b/sensorservices/orientationssy/data/10282F0F.RSS	Mon Oct 04 02:28:24 2010 +0300
@@ -37,6 +37,7 @@
                     version_no         = 1;
                     display_name       = "ORIENTATIONSSY";
                     default_data       = {
+#if 0
                                          // Orientation channel
                                          0x1, // ChannelInfoVersion
                                          0x27, //  ChannelInfoLength
@@ -48,7 +49,7 @@
                                          0x05, 0x4e, 0x6f, 0x6b, 0x69, 0x61, // VendorId: Nokia
                                          0x88, 0x50, 0x20, 0x10, // ChannelDataTypeId
                                          0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // ChannelSecurityPolicy
-                                         
+#endif
                                          // Rotation channel
                                          0x1, // ChannelInfoVersion
                                          0x27, //  ChannelInfoLength
--- a/sensorservices/orientationssy/inc/SsyConfiguration.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/sensorservices/orientationssy/inc/SsyConfiguration.h	Mon Oct 04 02:28:24 2010 +0300
@@ -86,6 +86,7 @@
  */
 const TSSsyChannelInfo KSSsyChannelInfo[] =
     {
+#if 0
         {       
             0,                                   // iChannelId
             ESensrvContextTypeUser,                  // iContextType
@@ -96,7 +97,7 @@
             sizeof(TSensrvOrientationData),      // iDataItemSize
             TSensrvOrientationData::KDataTypeId  // iDataTypeId
         },
-
+#endif
         {       
             0,                                   // iChannelId
             ESensrvContextTypeUser,                  // iContextType
--- a/sensorservices/sensordatacompensator/tsrc/sensordatacompensatortest/group/sensordatacompensatortest.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sensorservices/sensordatacompensator/tsrc/sensordatacompensatortest/group/sensordatacompensatortest.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -33,7 +33,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY     euser.lib
-LIBRARY     stiftestinterface.lib
+LIBRARY     StifTestInterface.lib
 LIBRARY     sensordatacompensator.lib
 
 SMPSAFE
--- a/sensorservices/sensorserver/tsrc/sensorsrvtest/SensorTestModule/group/SensorTestModule.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sensorservices/sensorserver/tsrc/sensorsrvtest/SensorTestModule/group/SensorTestModule.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -45,7 +45,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 
 LIBRARY         sensrvclient.lib
 LIBRARY         sensrvutil.lib
--- a/sysstatemgmt/ssmcmdlists/data/failcmdlist.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/ssmcmdlists/data/failcmdlist.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -177,10 +177,8 @@
     priority = 0xFFE7;
     name = "Z:\\sys\\bin\\sysap.exe";
     execution_behaviour = ESsmDeferredWaitForSignal;
-    severity = ECmdCriticalSeverity;
     retries = 2;
     background = 1; // To background
-    monitor_info = r_mon_reset;
     }
 
 // ===========================================================================
@@ -198,6 +196,3 @@
     substate = 0xFFFF; // KSsmAnySubState, saastateadapataion expects this
     }
 
-// monitoring.rss contains resource definitions, so it may not be included
-// before entry point.
-#include "monitoring.rss"
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/bwins/cmncustomcmdsu.def	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/cmncustomcmd/bwins/cmncustomcmdsu.def	Mon Oct 04 02:28:24 2010 +0300
@@ -1,5 +1,5 @@
 EXPORTS
-	?CmdPersistRebootsNewL@SsmCmnCustomCmdFactory@@SAPAVMSsmCustomCommand@@XZ @ 1 NONAME ; class MSsmCustomCommand * SsmCmnCustomCmdFactory::CmdPersistRebootsNewL(void)
+	?CmdPersistRebootsNewL@SsmCmnCustomCmdFactory@@SAPAVMSsmCustomCommand@@XZ @ 1 NONAME ABSENT ; class MSsmCustomCommand * SsmCmnCustomCmdFactory::CmdPersistRebootsNewL(void)
 	?CmdRendezvousWithEStartL@SsmCmnCustomCmdFactory@@SAPAVMSsmCustomCommand@@XZ @ 2 NONAME ; class MSsmCustomCommand * SsmCmnCustomCmdFactory::CmdRendezvousWithEStartL(void)
 	?CmdCancelMonitoringL@SsmCmnCustomCmdFactory@@SAPAVMSsmCustomCommand@@XZ @ 3 NONAME ; class MSsmCustomCommand * SsmCmnCustomCmdFactory::CmdCancelMonitoringL(void)
 
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/eabi/cmncustomcmdsu.def	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/cmncustomcmd/eabi/cmncustomcmdsu.def	Mon Oct 04 02:28:24 2010 +0300
@@ -1,5 +1,5 @@
 EXPORTS
-	_ZN22SsmCmnCustomCmdFactory21CmdPersistRebootsNewLEv @ 1 NONAME
+	_ZN22SsmCmnCustomCmdFactory21CmdPersistRebootsNewLEv @ 1 NONAME ABSENT
 	_ZN22SsmCmnCustomCmdFactory24CmdRendezvousWithEStartLEv @ 2 NONAME
 	_ZN22SsmCmnCustomCmdFactory20CmdCancelMonitoringLEv @ 3 NONAME
 
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/group/bld.inf	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/cmncustomcmd/group/bld.inf	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -20,5 +20,4 @@
 cmncustomcmds.mmp
 
 PRJ_EXPORTS
-../inc/cmdpersistreboots.hrh			/epoc32/include/ssm/cmdpersistreboots.hrh
 ./cmncustomcmds.iby						/epoc32/rom/include/cmncustomcmds.iby
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/group/cmncustomcmds.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/cmncustomcmd/group/cmncustomcmds.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -26,7 +26,7 @@
 UID				0x1000008D 0x2001A765
 VENDORID 		0x70000001
 
-CAPABILITY 		PowerMgmt ReadDeviceData WriteDeviceData ProtServ ProtServ DiskAdmin SwEvent
+CAPABILITY 		PowerMgmt ReadDeviceData WriteDeviceData ProtServ DiskAdmin SwEvent
 
 USERINCLUDE		../inc
 USERINCLUDE		../../localinc
@@ -36,16 +36,12 @@
 SOURCEPATH		../src
 SOURCE  		ssmcmncustomcmdfactory.cpp
 SOURCE			cmdrendezvouswithestart.cpp
-SOURCE			cmdpersistreboots.cpp
 SOURCE			cmdcancelmonitoring.cpp
 
 SOURCEPATH		../../localsrc
 SOURCE			ssmpanic.cpp
 
 LIBRARY		euser.lib
-LIBRARY		efsrv.lib
-LIBRARY		bafl.lib
-LIBRARY		estor.lib
 LIBRARY		sysmoncli.lib 
 
 
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/inc/cmdpersistreboots.h	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
- @released
-*/
-
-#ifndef __CMDPERSISTREBOOTS_H__
-#define __CMDPERSISTREBOOTS_H__
-
-#include <s32file.h>
-#include <s32mem.h>
-
-#include <ssm/ssmcustomcommand.h>
-#include <ssm/cmdpersistreboots.hrh>
-
-NONSHARABLE_CLASS (CCustomCmdPersistReboots) : public CBase, public MSsmCustomCommand
-	{
-public:
-	static CCustomCmdPersistReboots* NewL();
-	TUint8 BootCountFromLogL();
-
-	// From MSsmCustomCommand
-	TInt Initialize(CSsmCustomCommandEnv* aCmdEnv);
-	void Execute(const TDesC8& aParams, TRequestStatus& aStatus);
-	void Close();
-	void Release();
-	void ExecuteCancel();
-	
-private:
-	CCustomCmdPersistReboots();
-	~CCustomCmdPersistReboots();
-
-	void ConstructL();
-	void IncrementBootCountL();
-	void ResetBootCountL();
-	TCustCmdPersistRebootExecuteOption ExtractExecuteOptionL(const TDesC8& aParams);
-	void LogBootupCountL(TUint8 aCount);
-	void CreateLogIfNotExistL();
-private:
-	RFs iFs;
-	RBuf iBootupInfoPath;
-	};
-
-#endif // __CMDPERSISTREBOOTS_H__
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/inc/cmdpersistreboots.hrh	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef __CMDPERSISTREBOOTS_HRH__
-#define __CMDPERSISTREBOOTS_HRH__
-
-/**
- This enum is used for setting boot count values in bootupcount.log present in private/2000d75b/bootupinfo.
- 
- @publishedPartner
- @released
- */
-enum TCustCmdPersistRebootExecuteOption
-	{
-	EUndefined = 0,
-	EIncrementBootCount,	// increments boot count by 1.
-	EResetBootCount			// resets the boot count to 0.
-	};
-
-#endif // __CMDPERSISTREBOOTS_HRH__
-
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/src/cmdpersistreboots.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
- @released
-*/
-
-#include <bautils.h>
-
-#include "cmdpersistreboots.h"
-#include "ssmdebug.h"
-#include "ssmpanic.h"
-
-_LIT(KBootUpFolder, ":\\private\\2000d75b\\bootupinfo\\");
-_LIT(KBootUpFile, "bootupcount.bin");
-
-/**
- * Constructs and returns a new custom command, leaving on errors.
- * 
- * @internalComponent
- */
-CCustomCmdPersistReboots* CCustomCmdPersistReboots::NewL()
-	{
-	CCustomCmdPersistReboots* self = new (ELeave) CCustomCmdPersistReboots();
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	CleanupStack::Pop(self);
-	return self;
-	}
-
-void CCustomCmdPersistReboots::ConstructL()
-	{
-	const TChar drive = RFs::GetSystemDriveChar();
-	TInt length = KBootUpFolder().Length() + KBootUpFile().Length() + 1 /* for RFs::GetSystemDriveChar() */;
-	iBootupInfoPath.CreateL(length);
-	iBootupInfoPath.Append(drive);
-	iBootupInfoPath.Append(KBootUpFolder());
-	iBootupInfoPath.Append(KBootUpFile());
-	
-	}
-
-void CCustomCmdPersistReboots::CreateLogIfNotExistL()
-	{
-	__ASSERT_DEBUG(NULL != iFs.Handle(),PanicNow(KPanicSsmCustCmdRfs, EInvalidRFs));
-	const TBool found = BaflUtils::FileExists(iFs, iBootupInfoPath);
-
-	if(!found)
-		{
-		TInt err = iFs.MkDirAll(iBootupInfoPath);
-		if(KErrAlreadyExists != err && KErrNone != err)
-			User::Leave(err);
-		// create log file to store the number for bootup attempts
-		RFile file;
-		User::LeaveIfError(file.Create(iFs, iBootupInfoPath, EFileShareExclusive | EFileWrite | EFileRead));
-		file.Close();
-		LogBootupCountL(0);
-		}	
-	}
-
-CCustomCmdPersistReboots::CCustomCmdPersistReboots()
-	{
-	}
-
-CCustomCmdPersistReboots::~CCustomCmdPersistReboots()
-	{
-	iBootupInfoPath.Close();
-	}
-
-/**
- * Initializes this custom command.
- * 
- * @internalComponent
- */
-TInt CCustomCmdPersistReboots::Initialize(CSsmCustomCommandEnv* aCmdEnv)
-	{
-	iFs = aCmdEnv->Rfs();
-	TRAPD(ret, CreateLogIfNotExistL());
-	return ret;
-	}
-
-/**
- * Destory this object and any resources allocated to it.
- * 
- * @internalComponent
- */
-void CCustomCmdPersistReboots::Close()
-	{
-	}
-
-void CCustomCmdPersistReboots::Release()
-	{
-	delete this;
-	}
-
-/**
- * Issues the required rendezvous.
- * 
- * @internalComponent
- */
-void CCustomCmdPersistReboots::Execute(const TDesC8& aParams, TRequestStatus& aStatus)
-	{
-	aStatus = KRequestPending;
-	TCustCmdPersistRebootExecuteOption commandOption = EUndefined;
-
-	TInt err = KErrNone;
-	TRAP(err, commandOption = ExtractExecuteOptionL(aParams));
-
-	if(KErrNone != err)
-		{
-		TRequestStatus* statusPtr = &aStatus;
-		User::RequestComplete(statusPtr, err);
-		return;
-		}
-
-	switch (commandOption)
-		{
-		case EIncrementBootCount:
-			{
-			TRAP(err, IncrementBootCountL());
-			break;
-			}
-		case EResetBootCount:
-			{
-			TRAP(err, ResetBootCountL());
-			break;
-			}
-		default:
-			{
-			err = KErrArgument;
-			break;	
-			}
-		}
-
-	TRequestStatus* statusPtr = &aStatus;
-	User::RequestComplete(statusPtr, err);
-	}
-
-/**
- * Cancels the requested execute
- * 
- * @internalComponent
- */
-void CCustomCmdPersistReboots::ExecuteCancel()
-	{
-	// Nothing to do as request already completed in Execute()
-	}
-
-TUint8 CCustomCmdPersistReboots::BootCountFromLogL()
-	{
-	__ASSERT_DEBUG(NULL != iFs.Handle(),PanicNow(KPanicSsmCustCmdRfs, EInvalidRFs));
-	RFileReadStream file;
-	CleanupClosePushL(file);
-	User::LeaveIfError(file.Open(iFs, iBootupInfoPath, EFileRead));
-	TUint8 bootCount = file.ReadUint8L();
-	CleanupStack::PopAndDestroy(&file);
-	return bootCount;
-	}
-
-void CCustomCmdPersistReboots::IncrementBootCountL()
-	{
-	TUint8 bootCount = BootCountFromLogL();
-	LogBootupCountL(++bootCount);
-	DEBUGPRINT2A(" Tried booting the device (%d) time(s)", bootCount);
-	}
-
-void CCustomCmdPersistReboots::ResetBootCountL()
-	{
-	LogBootupCountL(0);	//always reset to 0
-	DEBUGPRINT1A(" Boot count reset to (0)");
-	}
-
-TCustCmdPersistRebootExecuteOption CCustomCmdPersistReboots::ExtractExecuteOptionL(const TDesC8& aParams)
-	{
-	RDesReadStream readStream(aParams);
-	CleanupClosePushL(readStream);
-	TCustCmdPersistRebootExecuteOption executeOption = (TCustCmdPersistRebootExecuteOption)readStream.ReadInt8L();
-	CleanupStack::PopAndDestroy(&readStream);
-	return executeOption;
-	}
-
-void CCustomCmdPersistReboots::LogBootupCountL(TUint8 aCount)
-	{
-	__ASSERT_DEBUG(NULL != iFs.Handle(),PanicNow(KPanicSsmCustCmdRfs, EInvalidRFs));
-	RFileWriteStream file;
-	CleanupClosePushL(file);
-	User::LeaveIfError(file.Open(iFs, iBootupInfoPath, EFileWrite));
-	file.WriteUint8L(aCount);
-	file.CommitL();
-	CleanupStack::PopAndDestroy(&file);
-	}
--- a/sysstatemgmt/systemstateplugins/cmncustomcmd/src/ssmcmncustomcmdfactory.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/cmncustomcmd/src/ssmcmncustomcmdfactory.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -21,7 +21,6 @@
 
 #include "ssmcmncustomcmdfactory.h"
 #include "cmdrendezvouswithestart.h"
-#include "cmdpersistreboots.h"
 #include "cmdcancelmonitoring.h"
 
 EXPORT_C MSsmCustomCommand* SsmCmnCustomCmdFactory::CmdRendezvousWithEStartL()
@@ -30,12 +29,6 @@
 	return self;
 	}
 
-EXPORT_C MSsmCustomCommand* SsmCmnCustomCmdFactory::CmdPersistRebootsNewL()
-	{
-	CCustomCmdPersistReboots* self = CCustomCmdPersistReboots::NewL();
-	return self;
-	}
-
 EXPORT_C MSsmCustomCommand* SsmCmnCustomCmdFactory::CmdCancelMonitoringL()
     {
     CCustomCmdCancelMonitoring* self = CCustomCmdCancelMonitoring::NewL();
--- a/sysstatemgmt/systemstateplugins/gsapolicy/bwins/gsastatepolicystartupu.def	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/bwins/gsastatepolicystartupu.def	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,3 @@
 EXPORTS
 	?NewL@CGsaStatePolicyStartup@@SAPAVMSsmStatePolicy@@XZ @ 1 NONAME ; class MSsmStatePolicy * CGsaStatePolicyStartup::NewL(void)
-	?KSsmMaxBootAttempts@@3HB @ 2 NONAME ; int const KSsmMaxBootAttempts
 
--- a/sysstatemgmt/systemstateplugins/gsapolicy/eabi/gsastatepolicystartupu.def	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/eabi/gsastatepolicystartupu.def	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,3 @@
 EXPORTS
 	_ZN22CGsaStatePolicyStartup4NewLEv @ 1 NONAME
-	KSsmMaxBootAttempts @ 2 NONAME DATA 4
 
--- a/sysstatemgmt/systemstateplugins/gsapolicy/group/bld.inf	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/group/bld.inf	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -19,8 +19,6 @@
 
 
 PRJ_EXPORTS
-../inc/cmdpersistreboots.rh		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/cmdpersistreboots.rh)
-../inc/ssmmaxbootattempts_patch.h 	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/ssmmaxbootattempts_patch.h)
 ./sspluginsgsa.iby			/epoc32/rom/include/sspluginsgsa.iby
 
 PRJ_MMPFILES
--- a/sysstatemgmt/systemstateplugins/gsapolicy/group/gsastatepolicystartup.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/group/gsastatepolicystartup.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -28,10 +28,11 @@
 
 USERINCLUDE		../inc
 USERINCLUDE		../../localinc
+USERINCLUDE     	../../../ssmpolicyplugins/cenrep
+
 
 SOURCEPATH		../src
 SOURCE			gsastatepolicystartup.cpp
-SOURCE			ssmmaxbootattempts_patch.cpp
 
 SOURCEPATH		../../localsrc
 SOURCE			ssmpanic.cpp
@@ -44,6 +45,7 @@
 LIBRARY			bafl.lib
 LIBRARY			efsrv.lib
 LIBRARY			estor.lib
+LIBRARY     		centralrepository.lib
 
 // "/private/<SID of SSM>/startup/<Value of KSystemStartupModeKey>/"
 SOURCEPATH		../resource
--- a/sysstatemgmt/systemstateplugins/gsapolicy/inc/cmdpersistreboots.rh	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Defines extra struct used for persisting reboots.
-// 
-//
-
-#ifndef __CMDPERSISTREBOOTS_RH__
-#define __CMDPERSISTREBOOTS_RH__
-
-#include <ssm/cmdpersistreboots.hrh>
-
-/**
- This struct is used to pass extra information for "LLINK dll_data in SSM_START_CUSTOM_COMMAND"
- 
- @publishedPartner
- @released
- @see TCustCmdPersistRebootExecuteOption
-*/
-STRUCT SSM_COMMAND_PERSIST_REBOOTS
-	{
-	BYTE val = EIncrementBootCount; //by default increment boot count by 1 in bootupcount.log (private/2000d75b/bootupinfo)
-	}
-
-#endif	// __CMDPERSISTREBOOTS_RH__
-
--- a/sysstatemgmt/systemstateplugins/gsapolicy/inc/gsastatepolicystartup.h	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/inc/gsastatepolicystartup.h	Mon Oct 04 02:28:24 2010 +0300
@@ -62,7 +62,7 @@
 	void ConstructL();
 	TBool TransitionSupported(const TSsmState& aRequestedState) const;	
 	void GetCommandListPath(TUint aBootMode, TDes& aCmdListPath);
-	TInt GetBootupCountL();
+	void GetStartupCountAndMaxbootLimitL(TInt &aBootCount, TInt &aResetLimit);
 
 private:
 	TInt iHardwareReason;
--- a/sysstatemgmt/systemstateplugins/gsapolicy/inc/ssmmaxbootattempts_patch.h	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef __SSMMAXBOOTATTEMPTS_PATCH_H__
-#define __SSMMAXBOOTATTEMPTS_PATCH_H__
-
-/**
- * Patchable constant.
- * 
- * This value determines the maximum number of unsuccessful device reboots allowed before powering off the device.
- * The default value for KSsmMaxBootAttempts is 3, ie., after 3 unsuccessful attempts to boot the device will be powered off.
- * 
- * If this value is set to '0xFFFFFFFF' boot failure will be ignored and attempts will be made to reboot forever.
- * 
- * Bootup information can be found in '<System drive>/private/<SID of SSM>/bootupinfo/bootupcount.log'.
- * 
- * To patch these values, add a line to an iby or oby file that is included in the rom being built using the following format:
- * 
- * "patchdata <dll> @ <symbol> <newvalue>"
- * 
- * e.g. to enable maximum attempts for device reboot, use the following line:
- * "patchdata ssm.state.policy.0000.dll @ KSsmMaxBootAttempts 3"
- * 
- * @SYMPatchable
- * @publishedPartner
- * @released
- * 
- */
-IMPORT_C extern const TInt KSsmMaxBootAttempts;
-
-#endif	// __SSMMAXBOOTATTEMPTS_PATCH_H__
--- a/sysstatemgmt/systemstateplugins/gsapolicy/resource/gsanormalcmdlist.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/resource/gsanormalcmdlist.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -17,8 +17,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 #include <ssm/clayerdlldatadefs.rh>
 #include <ssm/conditionresourcetypes.rh>
 
@@ -63,7 +61,6 @@
 		{
 		r_rendezvous_with_estart
 		, r_command_publish_state
-		, r_reset_boot_count
 		};
 	}
 
@@ -72,20 +69,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_reset_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_reset;
-	}
-
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_reset
-	{
-	val = EResetBootCount;
-	}
-
 RESOURCE SSM_START_CUSTOM_COMMAND r_rendezvous_with_estart
 	{
 	severity = ECmdCriticalSeverity;
--- a/sysstatemgmt/systemstateplugins/gsapolicy/src/gsastatepolicystartup.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/gsapolicy/src/gsastatepolicystartup.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -19,6 +19,7 @@
 #include <e32uid.h>
 #include <e32std.h>
 #include <bautils.h>
+#include <centralrepository.h>
 
 #include <ssm/ssmcmd.hrh>
 #include <ssm/ssmsubstates.hrh>
@@ -29,19 +30,12 @@
 
 #include <ssm/ssmstatetransition.h>
 #include <ssm/ssmcommandlistresourcereader.h>
-#include <ssm/ssmmaxbootattempts_patch.h>
 
 #include "gsastatepolicystartup.h"
 #include "ssmdebug.h"
 #include "ssmpanic.h" 
 #include "s32file.h" 
-
-_LIT(KBootUpFile, ":\\private\\2000d75b\\bootupinfo\\bootupcount.bin");
-
-/**
- Attempt to reboot the device (forever) on boot failure. Used when KSsmMaxBootAttempts is set to '0xFFFFFFFF'.
-*/
-const TInt KSsmAttemptRebootForever = 0xFFFFFFFF;
+#include "ssmpolicypluginsprivatecrkeys.h"
 
 /**
 Panic used by Startup policy plug-in when resource reader is invalid.
@@ -294,24 +288,16 @@
 			}
 #else	// on hardware/device
 			{
-			aNextState = TSsmState(ESsmFail, ESsmFailSubStateRestart);
-			if (KSsmAttemptRebootForever != KSsmMaxBootAttempts)
+			TInt resetLimit = -1;
+			TInt bootCount = -1;
+			TRAPD( err, GetStartupCountAndMaxbootLimitL(bootCount, resetLimit) );
+			if (bootCount < resetLimit && KErrNone == err)
 				{
-				// Get number of boot attempts made till now from bootup log file
-				TInt bootCount = -1;
-				TRAPD(err, bootCount = GetBootupCountL());	// ignore failure and restart the device, we should get the value next time.
-				if (err!=KErrNone)
-					{
-					DEBUGPRINT2(_L("Startup Policy : GetBootupCountL() failed with (error: %d), error is deliberately ignored."), aError);
-					}
-				if (bootCount < KSsmMaxBootAttempts)
-					{
-					aNextState = TSsmState(ESsmFail, ESsmFailSubStateRestart);
-					}
-				else	// Maximum allowed boot attempts has been made. Device needs a poweroff. Probable candidate for a reset/reflash.
-					{
-					aNextState = TSsmState(ESsmFail, ESsmFailSubStatePowerOff);
-					}
+				aNextState = TSsmState(ESsmFail, ESsmFailSubStateRestart);
+				}
+			else	// Maximum allowed boot attempts has been made. Device needs a poweroff. Probable candidate for a reset/reflash.
+				{
+				aNextState = TSsmState(ESsmFail, ESsmFailSubStatePowerOff);
 				}
 	#ifdef _DEBUG
 			TSsmStateName name = aNextState.Name();
@@ -452,29 +438,15 @@
 	}
 
 /*
-Helper function to get the boot count
+Helper function to get the startup boot count and maximum boot attempts limit 
+from the central repository
 */
-TInt CGsaStatePolicyStartup::GetBootupCountL()
+void CGsaStatePolicyStartup::GetStartupCountAndMaxbootLimitL(TInt &aBootcount, TInt &aResetLimit)
 	{
-	RBuf bootupInfoPath;
-	CleanupClosePushL(bootupInfoPath);
-	const TChar drive = RFs::GetSystemDriveChar();
-	TInt length = KBootUpFile().Length() + 1; /* for RFs::GetSystemDriveChar() */
-	bootupInfoPath.CreateL(length);
-	bootupInfoPath.Append(drive);
-	bootupInfoPath.Append(KBootUpFile());
-	TBool found = BaflUtils::FileExists(iFs, bootupInfoPath);
- 	if(!found)
- 		{
-		User::Leave(EBootupCountFileNotFound);
-		}
-
-	RFileReadStream file;
-	CleanupClosePushL(file);
-	User::LeaveIfError(file.Open(iFs, bootupInfoPath, EFileRead));
-	TInt bootCount = file.ReadUint8L();
-	CleanupStack::PopAndDestroy(&file);
-	CleanupStack::PopAndDestroy(&bootupInfoPath);
-	return bootCount;
+	CRepository* repository = CRepository::NewLC( KCRUidSsmStartupPolicy );
+	User::LeaveIfError( repository->Get( KSsmStartupErrorResetLimit, aResetLimit ) );
+	DEBUGPRINT2( _L("Reset limit is %d"), aResetLimit );
+	User::LeaveIfError( repository->Get( KSsmStartupErrorResetCounter, aBootcount ) );
+	DEBUGPRINT2( _L("Reset count is %d"), aBootcount );
+	CleanupStack::Pop(repository);
 	}
-	
--- a/sysstatemgmt/systemstateplugins/gsapolicy/src/ssmmaxbootattempts_patch.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include <e32std.h>
-
-/**
- * patchable const data values defined in ssmmaxbootattempts_patch.h
- */
-EXPORT_C extern const TInt KSsmMaxBootAttempts = 3;
-
--- a/sysstatemgmt/systemstateplugins/test/tappgsapolicy/group/sspluginstest_tappgsapolicy.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tappgsapolicy/group/sspluginstest_tappgsapolicy.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -33,6 +33,7 @@
 SOURCEPATH    	../src
 SOURCE        	sspluginstest_tappgsapolicy.cpp
 
+USERINCLUDE		../../../../ssmpolicyplugins/cenrep
 LIBRARY     euser.lib 
 LIBRARY		apparc.lib 
 LIBRARY		apgrfx.lib 
@@ -40,7 +41,9 @@
 LIBRARY		eikcore.lib
 LIBRARY		estor.lib
 LIBRARY		efsrv.lib 
-LIBRARY		bafl.lib 
+LIBRARY		bafl.lib
+LIBRARY     centralrepository.lib
+
 
 // Registration file
 SOURCEPATH		../resource
--- a/sysstatemgmt/systemstateplugins/test/tappgsapolicy/resource/gsastartupcmdlist7_target.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tappgsapolicy/resource/gsastartupcmdlist7_target.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -20,8 +20,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -64,8 +62,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -292,20 +289,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
-
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
-	
 RESOURCE SSM_START_APP_INFO r_command_eshell
 	{
 	severity = ECmdCriticalSeverity;
--- a/sysstatemgmt/systemstateplugins/test/tappgsapolicy/src/sspluginstest_tappgsapolicy.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tappgsapolicy/src/sspluginstest_tappgsapolicy.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -22,12 +22,12 @@
 #include <eikstart.h> 
 #include <eikapp.h>
 #include <bautils.h>
+#include <centralrepository.h>
 #include "sspluginstest_tappgsapolicy.h"
+#include "ssmpolicypluginsprivatecrkeys.h"
 
 //Fail to execute this exe for KDontRvBootCount times
 const TInt KDontRvBootCount = 3;
-_LIT(KBootUpFolder, ":\\private\\2000d75b\\bootupinfo\\");
-_LIT(KBootUpFile, "bootupcount.bin");
 
 /**
 Standard DLL entry point function.
@@ -127,12 +127,10 @@
  
  This particular test case can be used to test following
  1.Transitions to fail 
- 	To test above need to set KDontRvBootCount to KSsmMaxBootAttempts+1.
+ 	To test above need to set KDontRvBootCount to KSsmStartupErrorResetLimit+1.
  2.Persisted number of consecutive failed device start-ups
- 	To test above feature need set KDontRvBootCount to KSsmMaxBootAttempts
- 3.Transitions to restart to infinite times.
- 	To test above feature set KDontRvBootCount and KSsmMaxBootAttempts to 0xFFFFFFFF      	
-*/
+ 	To test above feature need set KDontRvBootCount to KSsmStartupErrorResetLimit
+ */
 void DoFrameworkCallsRendezvousL();
 
 TBool CTestAppUi::FrameworkCallsRendezvous() const
@@ -143,35 +141,15 @@
 
 void DoFrameworkCallsRendezvousL()
 	{
-	RFs fs;
-	User::LeaveIfError(fs.Connect());
-	CleanupClosePushL(fs);
-	RBuf bootupInfoPath;
-	CleanupClosePushL( bootupInfoPath );
-	const TChar drive = RFs::GetSystemDriveChar();
-	TInt length = KBootUpFolder().Length() + KBootUpFile().Length() + 1 /* for RFs::GetSystemDriveChar() */;
-	bootupInfoPath.CreateL(length);
-	bootupInfoPath.Append(drive);
-	bootupInfoPath.Append(KBootUpFolder());
-	bootupInfoPath.Append(KBootUpFile());
-	
-	TBool found = BaflUtils::FileExists(fs, bootupInfoPath);
-	TInt bootCount = 0;
-	if(found)
-		{
-		RFileReadStream file;
-		CleanupClosePushL(file);
-		User::LeaveIfError(file.Open(fs, bootupInfoPath, EFileRead));
-		bootCount = file.ReadUint8L();
-		RDebug::Printf("--- CTestAppUi::FrameworkCallsRendezvous() bootcount %d", bootCount);
-		CleanupStack::PopAndDestroy( &file );
-		}
-	CleanupStack::PopAndDestroy( &bootupInfoPath );
-	CleanupStack::PopAndDestroy( &fs );
-	if( bootCount < KDontRvBootCount )
+	CRepository* repository = CRepository::NewLC( KCRUidSsmStartupPolicy );
+	TInt Resetlimit;
+	User::LeaveIfError( repository->Get( KSsmStartupErrorResetLimit, Resetlimit ) );
+	CleanupStack::Pop(repository);
+	if( Resetlimit < KDontRvBootCount )
 		{
 		_LIT(KMainErrorStatement, "*** Program error in Starting sspluginstest_tappgsapolicy.exe: %d");
 		RDebug::Print(KMainErrorStatement, KErrNone);
 	   	User::Panic(KMainErrorStatement,KErrNone);
 		}
+
 	}
--- a/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/group/tcmncustomcmd_server.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/group/tcmncustomcmd_server.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -39,7 +39,6 @@
 SOURCEPATH		../src
 SOURCE			tcmncustomcmd_server.cpp
 SOURCE  		tcmncustomcmd_step_rendezvouswithestart.cpp
-SOURCE  		tcmncustomcmd_step_persistreboots.cpp
 SOURCE 			tcmncustomcmd_step_cancelmonitoring.cpp
 
 // production code
@@ -48,7 +47,6 @@
 SOURCEPATH		../../../cmncustomcmd/src
 SOURCE  		ssmcmncustomcmdfactory.cpp
 SOURCE  		cmdrendezvouswithestart.cpp
-SOURCE			cmdpersistreboots.cpp
 SOURCE			cmdcancelmonitoring.cpp
 
 SOURCEPATH		../../../localsrc
@@ -62,8 +60,6 @@
 LIBRARY			testexecuteutils.lib
 LIBRARY			testexecutelogclient.lib
 LIBRARY			ssmcmd.lib
-LIBRARY			estor.lib
-LIBRARY			bafl.lib
 LIBRARY			ssmcmn.lib
 LIBRARY			sysmoncli.lib
 
--- a/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/inc/tcmncustomcmd_step_persistreboots.h	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @test
- @internalComponent - Internal Symbian test code
-*/
-
-
-#ifndef __TCMNCUSTOMCMD_STEP_PERSISTREBOOTS_H__
-#define __TCMNCUSTOMCMD_STEP_PERSISTREBOOTS_H__
-
-#include <test/testexecutestepbase.h>
-
-_LIT(KTCCustomCmdTestPersistReboots, "CCustomCmdTestPersistReboots");
-
-class CCustomCmdTestPersistReboots: public CTestStep
-	{
-public:
-	CCustomCmdTestPersistReboots();
-	~CCustomCmdTestPersistReboots();
-
-	//from CTestStep
-	TVerdict doTestStepL();
-
-private:
-	void TestCustomCmdPersistRebootsL();
-	};
-
-#endif	// __TCMNCUSTOMCMD_STEP_PERSISTREBOOTS_H__
\ No newline at end of file
--- a/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/scripts/sspluginstest_cmncustomcmd_persistreboots.script	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-PRINT Run CCustomCmdTestPersistReboots tests
-
-LOAD_SUITE tcmncustomcmd_server
-
-START_TESTCASE 			DEVSRVS-SSPLUGINS-CUSTCMD-0001
-//! @SYMTestCaseID  		DEVSRVS-SSPLUGINS-CUSTCMD-0001
-//! @SYMPREQ 			PREQ1871
-//! @SYMDEF			DEF120446
-//! @SYMTestType		UT
-//! @SYMTestPriority		Normal
-//! @SYMTestStatus 		Implemented
-//! @SYMTestCaseDesc		Tests the behaviour of CCustomCmdPersistReboots.
-//! @SYMTestActions		The test performs operations on a CCustomCmdPersistReboots object, namely calling the following methods:
-//! 					1.NewL - Creating the object
-//! 					2.Initialize - Initialising the custom cmd
-//! 					3.Execute - Executing the custom cmd
-//! @SYMTestExpectedResults 	Command should execute normally and should complete with KErrNone.
-RUN_TEST_STEP 100 tcmncustomcmd_server CCustomCmdTestPersistReboots
-END_TESTCASE 			DEVSRVS-SSPLUGINS-CUSTCMD-0001
\ No newline at end of file
--- a/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/scripts/sspluginstest_cmncustomcmd_run.bat	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/scripts/sspluginstest_cmncustomcmd_run.bat	Mon Oct 04 02:28:24 2010 +0300
@@ -1,5 +1,5 @@
 @rem
-@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 @rem All rights reserved.
 @rem This component and the accompanying materials are made available
 @rem under the terms of "Eclipse Public License v1.0"
@@ -15,7 +15,6 @@
 @rem
 
 testexecute.exe z:\sspluginstest\sspluginstest_cmncustomcmd_rendezvouswithestart.script
-testexecute.exe z:\sspluginstest\sspluginstest_cmncustomcmd_persistreboots.script
 testexecute.exe z:\sspluginstest\sspluginstest_cmncustomcmd_cancelmonitoring.script
 
 :: Ignore the following if using this script for emulator testing.
--- a/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/src/tcmncustomcmd_server.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/src/tcmncustomcmd_server.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -21,7 +21,6 @@
 
 #include "tcmncustomcmd_server.h"
 #include "tcmncustomcmd_step_rendezvouswithestart.h"
-#include "tcmncustomcmd_step_persistreboots.h"
 #include "tcmncustomcmd_step_cancelmonitoring.h"
 
 _LIT(KCustomCmdTestServerName, "tcmncustomcmd_server");
@@ -84,11 +83,7 @@
 		{
 		testStep = new CCustomCmdTestRendezvousWithEStart();
 		}
-	else if (aStepName == KTCCustomCmdTestPersistReboots)
-		{
-		testStep = new CCustomCmdTestPersistReboots();
-		}	
-    else if (aStepName == KTCCustomCmdTestCancelMonitoring)
+	else if (aStepName == KTCCustomCmdTestCancelMonitoring)
         {
         testStep = new CCustomCmdTestCancelMonitoring();
         }   
--- a/sysstatemgmt/systemstateplugins/test/tcmncustomcmd/src/tcmncustomcmd_step_persistreboots.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @test
- @internalComponent - Internal Symbian test code 
-*/
-
-#include "tcmncustomcmd_step_persistreboots.h"
-#include "ssmcmncustomcmdfactory.h"
-#include "cmdpersistreboots.h"
-#include <ssm/ssmcustomcommand.h>
-
-CCustomCmdTestPersistReboots::~CCustomCmdTestPersistReboots()
-	{
-	}
-
-CCustomCmdTestPersistReboots::CCustomCmdTestPersistReboots()
-	{
-	SetTestStepName(KTCCustomCmdTestPersistReboots);
-	}
-
-/**
-Old Test CaseID 		APPFWK-CUSTCMD-0001
-New Test CaseID 		DEVSRVS-SSPLUGINS-CUSTCMD-0001
- */
-
-void CCustomCmdTestPersistReboots::TestCustomCmdPersistRebootsL()
-	{
-	INFO_PRINTF1(_L("TestCustomCmdPersistRebootsL"));
-
-	//Create Persist Reboots custom command
-	MSsmCustomCommand* customCmdPersistReboots = SsmCmnCustomCmdFactory::CmdPersistRebootsNewL();
-	RFs aFs;
-	aFs.Connect();
-	CSsmCustomCommandEnv* cmdEnv = CSsmCustomCommandEnv::NewL(aFs);
-	CleanupStack::PushL(cmdEnv);
-	
-	//Initialise the command.
-	customCmdPersistReboots->Initialize(cmdEnv);
-
-	TRequestStatus status;
-	
-	//Create an invalid enum value to pass to Execute
-	TCustCmdPersistRebootExecuteOption executeOption=static_cast<TCustCmdPersistRebootExecuteOption>(EIncrementBootCount+100);
-	TPckgBuf<TCustCmdPersistRebootExecuteOption> pckgExecuteOption(executeOption);
-	
-	
-	customCmdPersistReboots->Execute(pckgExecuteOption, status);
-	customCmdPersistReboots->ExecuteCancel();
-	
-	//Reference plugins doesnt have Cancel implementation and also by the time ExecuteCancel()
-	//is called it might have completed executing Execute() function. Thats is the reason for 
-	//checking the status to KErrNone instead of KErrCancel.
-	User::WaitForRequest(status);
-	TEST(KErrArgument == status.Int());
-	
-	//EIncrementBootCount is incremented in the loop so EResetBootCount also tested
-	for (int i=0;i<2;i++)
-		{
-			executeOption=static_cast<TCustCmdPersistRebootExecuteOption>(EIncrementBootCount+i);
-			TPckgBuf<TCustCmdPersistRebootExecuteOption> pckgExecuteOption(executeOption);
-			
-			customCmdPersistReboots->Execute(pckgExecuteOption, status);
-			User::WaitForRequest(status);
-			TEST(KErrNone == status.Int());
-		}
-	
-	
-	customCmdPersistReboots->Close();
-	customCmdPersistReboots->Release();
-	CleanupStack::PopAndDestroy(cmdEnv);
-	INFO_PRINTF1(_L("Ending the CCustomCmdTestPersistReboots tests "));
-
-	}
-
-TVerdict CCustomCmdTestPersistReboots::doTestStepL()
-	{
-	__UHEAP_MARK;
-	TestCustomCmdPersistRebootsL();
-	__UHEAP_MARKEND;
-	return TestStepResult();
-	}
--- a/sysstatemgmt/systemstateplugins/test/tunitgsapolicy/group/tgsa_server.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tunitgsapolicy/group/tgsa_server.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -35,6 +35,7 @@
 USERINCLUDE		../../../gsapolicy/inc
 USERINCLUDE		../../../localinc
 USERINCLUDE		../../../../ssmpolicyplugins/inc
+USERINCLUDE		../../../../ssmpolicyplugins/cenrep
 
 SOURCEPATH		../src
 SOURCE			tgsa_server.cpp
@@ -49,7 +50,6 @@
 SOURCE			gsastatepolicyshutdown.cpp
 SOURCE			gsastatepolicynormal.cpp
 SOURCE			gsastatepolicyfail.cpp
-SOURCE			ssmmaxbootattempts_patch.cpp
 
 SOURCEPATH		../../../localsrc
 SOURCE			ssmpanic.cpp
@@ -68,5 +68,6 @@
 LIBRARY			ssmsuscli.lib
 LIBRARY			ssmstartsafe.lib
 LIBRARY			conditionevaluator.lib
+LIBRARY			centralrepository.lib
 
 SMPSAFE
--- a/sysstatemgmt/systemstateplugins/test/tunitgsapolicy/src/tgsa_step_normal.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tunitgsapolicy/src/tgsa_step_normal.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -30,7 +30,7 @@
 
 #include "tgsa_step_normal.h"
 
-TSsmCommandType ArrNormal[] = { ESsmCmdCustomCommand, ESsmCmdPublishSystemState, ESsmCmdCustomCommand };
+TSsmCommandType ArrNormal[] = { ESsmCmdCustomCommand, ESsmCmdPublishSystemState };
 
 
 CGsaNormalTest::~CGsaNormalTest()
--- a/sysstatemgmt/systemstateplugins/test/tunitgsapolicy/src/tgsa_step_startup.cpp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/systemstateplugins/test/tunitgsapolicy/src/tgsa_step_startup.cpp	Mon Oct 04 02:28:24 2010 +0300
@@ -75,6 +75,8 @@
                                             ESsmCmdLoadSup,             //r_cmd_loadregion
                                             ESsmCmdLoadSup,             //r_cmd_loaduilanguage
                                             ESsmCmdCustomCommand,       //r_cmd_aknstart
+                                            ESsmCmdStartProcess,        //r_cmd_devicedialog
+                                            ESsmCmdStartProcess,         //r_cmd_hbthemeserver
                                             ESsmCmdWaitForApparcInit,   //r_cmd_apparc_init
                                             ESsmCmdCustomCommand        //r_cmd_rfspostui
                                             };
--- a/sysstatemgmt/tsrc/public/basic/group/mt_rstartersession.mmp	Fri Sep 17 08:36:42 2010 +0300
+++ b/sysstatemgmt/tsrc/public/basic/group/mt_rstartersession.mmp	Mon Oct 04 02:28:24 2010 +0300
@@ -34,7 +34,7 @@
 OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY     	stiftestinterface.lib
+LIBRARY     	StifTestInterface.lib
 LIBRARY         StarterClient.lib
 
 SMPSAFE
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0033_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0033_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_faileiofcount0
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0034_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0034_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_faileiofcount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0035_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0035_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_faileroscount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0036_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0036_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_faileroswmcount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0037_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0037_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,8 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +289,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_failcount2failquick
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0038_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0038_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_failcount2failwait
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0039_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0039_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartreg
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0040_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0040_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartfail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0041_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0041_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartfailwithmode1
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0042_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0042_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartfailwithmode2
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0043_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0043_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,4 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
-
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0044_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0044_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,4 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
-
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0045_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0045_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,4 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
-
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0046_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0046_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,4 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
-
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0047_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0047_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,4 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
-
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0048_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0048_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,5 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0049_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0049_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -308,17 +305,5 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0054_emulator0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/emulator/appfwk-sysmon-0054_emulator0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -19,8 +19,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -63,8 +61,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -291,19 +288,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_failecnorcount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0035_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0035_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_faileroscount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0036_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0036_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_faileroswmcount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0037_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0037_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_failcount2failquick
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0039_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0039_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartreg
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0040_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0040_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartfail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0041_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0041_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartfailwithmode1
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0042_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0042_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_restartfailwithmode2
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0045_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0045_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -310,17 +307,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
+
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0046_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0046_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -310,17 +307,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
+
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0047_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0047_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -310,17 +307,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
+
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0048_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0048_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -310,17 +307,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
+
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0049_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0049_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -310,17 +307,6 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
+
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0054_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-0054_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -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"
@@ -21,8 +21,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 
 UID2 KUidSsmCommandListResourceFile
 
@@ -65,8 +63,7 @@
    	{
 	commands =
 		{
-		r_increment_boot_count
-		, r_command_publish_system_state
+		r_command_publish_system_state
 		, r_command_ssmutilsrv
 		, r_command_sysmon
 		, r_command_sysagt2svr
@@ -293,19 +290,7 @@
 	severity = ECmdCriticalSeverity;
 	}
 
-RESOURCE SSM_START_CUSTOM_COMMAND r_increment_boot_count
-	{
-	severity = ECmdCriticalSeverity;
-	execution_behaviour = ESsmWaitForSignal;
-	dllname = "cmncustomcmds.dll";
-	ordinal = 1; // Persist reboots custom command is at ordinal 1
-	dll_data = r_increment;
-	}
 
-RESOURCE SSM_COMMAND_PERSIST_REBOOTS r_increment
-	{
-	val = EIncrementBootCount;
-	}
 
 RESOURCE SSM_START_PROCESS_INFO r_command_app_failecnorcount1fail
 	{
--- a/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-eiof_hardware0.rss	Fri Sep 17 08:36:42 2010 +0300
+++ b/systemhealthmanagement/systemhealthmgr/test/tsysmon/resource/hardware/appfwk-sysmon-eiof_hardware0.rss	Mon Oct 04 02:28:24 2010 +0300
@@ -18,8 +18,6 @@
 
 #include <ssm/ssmcmd.rh>
 #include <ssm/ssmsubstates.hrh>
-#include <ssm/cmdpersistreboots.rh>
-#include <ssm/cmdpersistreboots.hrh>
 #include "ssmsubstateext.hrh"
 
 UID2 KUidSsmCommandListResourceFile