Revision: 201029 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 16:06:48 +0300
branchRCL_3
changeset 9 5c72fd91570d
parent 5 8116cc943311
child 10 594d15129e2c
Revision: 201029 Kit: 201035
group/bld.inf
layers.sysdef.xml
package_definition.xml
package_map.xml
services/group/bld.inf
services/terminalmodeservice/bwins/terminalmodeserviceu.def
services/terminalmodeservice/eabi/terminalmodeserviceu.def
services/terminalmodeservice/group/bld.inf
services/terminalmodeservice/group/terminalmodeservice.mmp
services/terminalmodeservice/inc/upnpappfilterinfo.h
services/terminalmodeservice/inc/upnpappfilterinfo.inl
services/terminalmodeservice/inc/upnpiconconversionactive.h
services/terminalmodeservice/inc/upnpiconfileservetransaction.h
services/terminalmodeservice/inc/upnpremotableappstore.h
services/terminalmodeservice/inc/upnpsvgimageconverter.h
services/terminalmodeservice/inc/upnptmappserverservice.h
services/terminalmodeservice/inc/upnptmclientprofileservice.h
services/terminalmodeservice/inc/upnptmfilteredapplist.h
services/terminalmodeservice/inc/upnptmiconmapping.h
services/terminalmodeservice/inc/upnptmserverdescriptionprovider.h
services/terminalmodeservice/inc/upnptmserverdevice.h
services/terminalmodeservice/inc/upnptmserverdevicexmlparser.h
services/terminalmodeservice/inc/upnptmserverdevicexmlparser.inl
services/terminalmodeservice/inc/upnptmserverimpl.h
services/terminalmodeservice/rom/terminalmodeservice.iby
services/terminalmodeservice/src/upnpappfilterinfo.cpp
services/terminalmodeservice/src/upnpiconconversionactive.cpp
services/terminalmodeservice/src/upnpiconfileservetransaction.cpp
services/terminalmodeservice/src/upnpremotableapp.cpp
services/terminalmodeservice/src/upnpremotableappstore.cpp
services/terminalmodeservice/src/upnpsvgimageconverter.cpp
services/terminalmodeservice/src/upnpterminalmodeicon.cpp
services/terminalmodeservice/src/upnptmappserverservice.cpp
services/terminalmodeservice/src/upnptmclienticonpref.cpp
services/terminalmodeservice/src/upnptmclientprofileservice.cpp
services/terminalmodeservice/src/upnptmfilteredapplist.cpp
services/terminalmodeservice/src/upnptmiconmapping.cpp
services/terminalmodeservice/src/upnptminfoelement.cpp
services/terminalmodeservice/src/upnptmserver.cpp
services/terminalmodeservice/src/upnptmserverdescriptionprovider.cpp
services/terminalmodeservice/src/upnptmserverdevice.cpp
services/terminalmodeservice/src/upnptmserverdeviceinfo.cpp
services/terminalmodeservice/src/upnptmserverdevicexmlparser.cpp
services/terminalmodeservice/src/upnptmserverimpl.cpp
services/terminalmodeservice/traces/OstTraceDefinitions.h
services/terminalmodeservice/tsrc/upnptmservertest/bwins/upnptmservertestu.DEF
services/terminalmodeservice/tsrc/upnptmservertest/data/TestFramework.ini
services/terminalmodeservice/tsrc/upnptmservertest/data/gallery.svg
services/terminalmodeservice/tsrc/upnptmservertest/data/homemedia.svg
services/terminalmodeservice/tsrc/upnptmservertest/data/maps.svg
services/terminalmodeservice/tsrc/upnptmservertest/data/music_launched.svg
services/terminalmodeservice/tsrc/upnptmservertest/data/music_unlaunched.svg
services/terminalmodeservice/tsrc/upnptmservertest/data/s60_device.svg
services/terminalmodeservice/tsrc/upnptmservertest/data/videos.svg
services/terminalmodeservice/tsrc/upnptmservertest/eabi/upnptmservertestu.DEF
services/terminalmodeservice/tsrc/upnptmservertest/group/bld.inf
services/terminalmodeservice/tsrc/upnptmservertest/group/upnptmservertest.mmp
services/terminalmodeservice/tsrc/upnptmservertest/group/upnptmservertest.pkg
services/terminalmodeservice/tsrc/upnptmservertest/inc/discoverytesttimer.h
services/terminalmodeservice/tsrc/upnptmservertest/inc/testtimer.h
services/terminalmodeservice/tsrc/upnptmservertest/inc/tmservertest.h
services/terminalmodeservice/tsrc/upnptmservertest/src/discoverytesttimer.cpp
services/terminalmodeservice/tsrc/upnptmservertest/src/testtimer.cpp
services/terminalmodeservice/tsrc/upnptmservertest/src/tmservertest.cpp
services/terminalmodeservice/tsrc/upnptmservertest/src/tmservertestcases.cpp
services/terminalmodeservice_plat/group/bld.inf
services/terminalmodeservice_plat/inc/terminalmodeconsts.h
services/terminalmodeservice_plat/inc/upnpremotableapp.h
services/terminalmodeservice_plat/inc/upnpremotableapp.inl
services/terminalmodeservice_plat/inc/upnpterminalmodeicon.h
services/terminalmodeservice_plat/inc/upnpterminalmodeicon.inl
services/terminalmodeservice_plat/inc/upnptmclienticonpref.h
services/terminalmodeservice_plat/inc/upnptmclienticonpref.inl
services/terminalmodeservice_plat/inc/upnptminfoelement.h
services/terminalmodeservice_plat/inc/upnptminfoelement.inl
services/terminalmodeservice_plat/inc/upnptmserver.h
services/terminalmodeservice_plat/inc/upnptmserverdeviceinfo.h
services/terminalmodeservice_plat/inc/upnptmserverdeviceinfo.inl
services/terminalmodeservice_plat/inc/upnptmserverobserver.h
upnp/upnpstack/controlpointbase/src/upnpcpbdescriptionagent.cpp
upnp/upnpstack/controlpointbase/src/upnpcpbembeddeddevicedescription.cpp
upnp/upnpstack/controlpointbase/src/upnpserviceinfo.cpp
upnp/upnpstack/dlnawebserver/group/dlnawebserver.mmp
upnp/upnpstack/dlnawebserver/src/upnphttpbuffer.cpp
upnp/upnpstack/dlnawebserver/src/upnphttpchunkparser.cpp
upnp/upnpstack/dlnawebserver/src/upnphttpsession.cpp
upnp/upnpstack/dlnawebserver/src/upnptcpserver.cpp
upnp/upnpstack/messagehandler/src/upnpipfiltering.cpp
upnp/upnpstack/serviceframework/src/upnpdevice.cpp
upnp/upnpstack/serviceframework/src/upnpdeviceimplementation.cpp
upnp/upnpstack/serviceframework/src/upnpdeviceimplementationbase.cpp
upnp/upnpstack/serviceframework/src/upnpdispatcherengine.cpp
upnp/upnpstack/serviceframework/src/upnpsilentdeviceimplementation.cpp
upnp/upnpstack/serviceframework/src/upnpsoapmessagefactory.cpp
upnp/upnpstack/upnphttptransfer/src/httpfile.cpp
upnp/upnpstack/upnputils/src/upnpdevicelibrary.cpp
upnp/upnpstack/upnputils/src/upnpdominterface.cpp
upnp/upnpstack_plat/upnp_device_api/inc/upnpdevicedescriptionstore.h
upnp/upnpstack_plat/upnp_utils_api/inc/upnpdominterface.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information for srvdiscovery
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+#include "../upnp/group/bld.inf"
+#include "../services/group/bld.inf"
+#include "../servicediscoveryandcontrol/pnp/group/bld.inf"
+
+
+PRJ_TESTMMPFILES
\ No newline at end of file
--- a/layers.sysdef.xml	Mon Mar 15 12:43:29 2010 +0200
+++ b/layers.sysdef.xml	Tue Aug 31 16:06:48 2010 +0300
@@ -1,13 +1,14 @@
-<?xml version="1.0"?><!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [  
- <!ENTITY layer_real_source_path "sf/mw/srvdiscovery" >
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/mw/srvdiscovery" >
 ]>
-<SystemDefinition name="ossrv" schema="1.4.0">  
-<systemModel> 
-<!-- Common file for prebuild layers-->          
-<layer name="mw_layer">                        
-<module name="upnp">                             
-<unit name="upnp" unitID="mrtdo.upnp" bldFile="&layer_real_source_path;/upnp/group" mrp="" />
-</module>    
-</layer>        
-</systemModel>
+
+<SystemDefinition name="srvdiscovery" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="srvdiscovery">
+        <unit unitID="netdo.srvdiscovery" mrp="" bldFile="&layer_real_source_path;/group" name="srvdiscovery" />
+      </module>
+    </layer>
+  </systemModel>
 </SystemDefinition>
\ No newline at end of file
--- a/package_definition.xml	Mon Mar 15 12:43:29 2010 +0200
+++ b/package_definition.xml	Tue Aug 31 16:06:48 2010 +0300
@@ -1,15 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <SystemDefinition schema="3.0.0">
-  <package id="srvdiscovery" name="Service Discovery and Usage" levels="plugin framework server generic specific">
-    <collection id="servicediscoveryandcontrol" name="Service Discovery and Control" level="framework">
-      <component id="servicediscoveryfw" name="Service Discovery Framework" introduced="^3" purpose="optional">
-        <unit bldFile="servicediscoveryandcontrol/pnp/group" mrp="servicediscoveryandcontrol/pnp/group/servicediscoveryframework.mrp"/>
-      </component>
-    </collection>
-    <collection id="srvdiscovery_info" name="Service Discovery and Usage Info" level="specific">
-      <component id="srvdiscovery_metadata" name="Service Discovery and Usage Metadata" class="config" introduced="^2" purpose="development" target="desktop">
-        <unit mrp="srvdiscovery_info/srvdiscovery_metadata/srvdiscovery_metadata.mrp"/>
-      </component>
-    </collection>
-  </package>
+ <package id="srvdiscovery" name="Service Discovery and Usage" levels="plugin framework server generic specific">
+  <collection id="upnpstack_plat" name="UPnP Stack Platform Interfaces" level="specific">
+   <component id="upnp_device_api" name="UPnP Device API" purpose="optional" introduced="^3" class="api" filter="s60">
+    <meta rel="Api" href="upnp/upnpstack_plat/upnp_device_api/upnp_device_api.metaxml"/>
+    <unit bldFile="upnp/upnpstack_plat/upnp_device_api/group"/>
+   </component>
+   <component id="upnp_common_api" name="UPnP Common API" purpose="optional" introduced="^3" class="api" filter="s60">
+    <meta rel="Api" href="upnp/upnpstack_plat/upnp_common_api/upnp_common_api.metaxml"/>
+    <unit bldFile="upnp/upnpstack_plat/upnp_common_api/group"/>
+   </component>
+   <component id="upnp_utils_api" name="UPnP Utils API" purpose="optional" introduced="^3" class="api" filter="s60">
+    <meta rel="Api" href="upnp/upnpstack_plat/upnp_utils_api/upnp_utils_api.metaxml"/>
+    <unit bldFile="upnp/upnpstack_plat/upnp_utils_api/group"/>
+   </component>
+   <component id="upnp_control_point_api" name="UPnP Control Point API" purpose="optional" introduced="^3" class="api" filter="s60">
+    <meta rel="Api" href="upnp/upnpstack_plat/upnp_control_point_api/upnp_control_point_api.metaxml"/>
+    <unit bldFile="upnp/upnpstack_plat/upnp_control_point_api/group"/>
+   </component>
+   <component id="upnp_httpserver_api" name="UPnP HTTP Server API" purpose="optional" introduced="^3" class="api" filter="s60">
+    <meta rel="Api" href="upnp/upnpstack_plat/upnp_httpserver_api/upnp_httpserver_api.metaxml"/>
+    <unit bldFile="upnp/upnpstack_plat/upnp_httpserver_api/group"/>
+   </component>
+   <component id="upnp_http_transfer_api" name="UPnP HTTP Transfer API" purpose="optional" introduced="^3" class="api" filter="s60">
+    <meta rel="Api" href="upnp/upnpstack_plat/upnp_http_transfer_api/upnp_http_transfer_api.metaxml"/>
+    <unit bldFile="upnp/upnpstack_plat/upnp_http_transfer_api/group"/>
+   </component>
+  </collection>
+  <collection id="servicediscoveryandcontrol" name="Service Discovery and Control" level="framework">
+      <component id="servicediscoveryfw" name="Service Discovery Framework" introduced="^3" purpose="optional" filter="s60">
+    <unit bldFile="servicediscoveryandcontrol/pnp/group" mrp="servicediscoveryandcontrol/pnp/group/servicediscoveryframework.mrp"/>
+   </component>
+  </collection>
+  <collection id="upnp" name="UPnP" level="server">
+      <component id="upnpstack" name="UPnP Stack" introduced="^3" purpose="optional" filter="s60">
+    <unit bldFile="upnp/upnpstack/group"/>
+   </component>
+  </collection>
+  <collection id="srvdiscovery_info" name="Service Discovery and Usage Info" level="specific">
+      <component id="srvdiscovery_metadata" name="Service Discovery and Usage Metadata" class="config" introduced="^2" purpose="development" target="desktop" filter="s60">
+    <unit mrp="srvdiscovery_info/srvdiscovery_metadata/srvdiscovery_metadata.mrp"/>
+   </component>
+  </collection>
+ </package>
 </SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="mw"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/group/bld.inf	Tue Aug 31 16:06:48 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: This file provides the information required for building the
+*	       whole of terminalmodeservice_plat and terminalmodeservice.
+*
+*/
+
+
+// Export domain headers
+#include "../terminalmodeservice_plat/group/bld.inf"
+
+
+// terminalmodeservice
+#include "../terminalmodeservice/group/bld.inf"
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/bwins/terminalmodeserviceu.def	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,28 @@
+EXPORTS
+	?SetResourceStatusL@CUpnpRemotableApp@@QAEXABVTDesC8@@@Z @ 1 NONAME ; void CUpnpRemotableApp::SetResourceStatusL(class TDesC8 const &)
+	?StopL@CUpnpTmServer@@QAEXXZ @ 2 NONAME ; void CUpnpTmServer::StopL(void)
+	?NewL@CUpnpTmServer@@SAPAV1@AAVCUpnpTmServerDeviceInfo@@AAVMUpnpTmServerObserver@@@Z @ 3 NONAME ; class CUpnpTmServer * CUpnpTmServer::NewL(class CUpnpTmServerDeviceInfo &, class MUpnpTmServerObserver &)
+	?AddTmInfoElementL@CUpnpTmInfoElement@@QAEXABVTDesC8@@0@Z @ 4 NONAME ; void CUpnpTmInfoElement::AddTmInfoElementL(class TDesC8 const &, class TDesC8 const &)
+	?SetXmlSignatureL@CUpnpTmServer@@QAEXABVTDesC8@@@Z @ 5 NONAME ; void CUpnpTmServer::SetXmlSignatureL(class TDesC8 const &)
+	?SetAppDescriptionL@CUpnpRemotableApp@@QAEXABVTDesC8@@@Z @ 6 NONAME ; void CUpnpRemotableApp::SetAppDescriptionL(class TDesC8 const &)
+	?RegisterAppL@CUpnpTmServer@@QAEXPAVCUpnpRemotableApp@@@Z @ 7 NONAME ; void CUpnpTmServer::RegisterAppL(class CUpnpRemotableApp *)
+	?NewL@CUpnpTerminalModeIcon@@SAPAV1@ABVTDesC16@@HHHABVTDesC8@@@Z @ 8 NONAME ; class CUpnpTerminalModeIcon * CUpnpTerminalModeIcon::NewL(class TDesC16 const &, int, int, int, class TDesC8 const &)
+	?NewL@CUpnpTmClientIconPref@@SAPAV1@I@Z @ 9 NONAME ; class CUpnpTmClientIconPref * CUpnpTmClientIconPref::NewL(unsigned int)
+	?SetDeviceInfoL@CUpnpTmServerDeviceInfo@@QAEXABVTDesC8@@@Z @ 10 NONAME ; void CUpnpTmServerDeviceInfo::SetDeviceInfoL(class TDesC8 const &)
+	?AddDeviceIconL@CUpnpTmServerDeviceInfo@@QAEXPAVCUpnpTerminalModeIcon@@@Z @ 11 NONAME ; void CUpnpTmServerDeviceInfo::AddDeviceIconL(class CUpnpTerminalModeIcon *)
+	?UpdateAppListL@CUpnpTmServer@@QAEXABV?$RArray@I@@@Z @ 12 NONAME ; void CUpnpTmServer::UpdateAppListL(class RArray<unsigned int> const &)
+	?AddIconL@CUpnpRemotableApp@@QAEXPAVCUpnpTerminalModeIcon@@@Z @ 13 NONAME ; void CUpnpRemotableApp::AddIconL(class CUpnpTerminalModeIcon *)
+	?CreateTmInfoElementL@CUpnpRemotableApp@@QAEAAVCUpnpTmInfoElement@@W4TTerminalModeInfoType@2@@Z @ 14 NONAME ; class CUpnpTmInfoElement & CUpnpRemotableApp::CreateTmInfoElementL(enum CUpnpTmInfoElement::TTerminalModeInfoType)
+	?UnRegisterApp@CUpnpTmServer@@QAEHI@Z @ 15 NONAME ; int CUpnpTmServer::UnRegisterApp(unsigned int)
+	?StartL@CUpnpTmServer@@QAEXXZ @ 16 NONAME ; void CUpnpTmServer::StartL(void)
+	?NewL@CUpnpRemotableApp@@SAPAV1@IABVTDesC8@@@Z @ 17 NONAME ; class CUpnpRemotableApp * CUpnpRemotableApp::NewL(unsigned int, class TDesC8 const &)
+	?UpdateUnusedProfileIdsL@CUpnpTmServer@@QAEXABV?$RArray@I@@@Z @ 18 NONAME ; void CUpnpTmServer::UpdateUnusedProfileIdsL(class RArray<unsigned int> const &)
+	?GetRemotableApp@CUpnpTmServer@@QAEAAVCUpnpRemotableApp@@IAAH@Z @ 19 NONAME ; class CUpnpRemotableApp & CUpnpTmServer::GetRemotableApp(unsigned int, int &)
+	?UpdateAppStatusL@CUpnpTmServer@@QAEXABV?$RArray@I@@@Z @ 20 NONAME ; void CUpnpTmServer::UpdateAppStatusL(class RArray<unsigned int> const &)
+	?UnRegisterApps@CUpnpTmServer@@QAEHABV?$RArray@I@@@Z @ 21 NONAME ; int CUpnpTmServer::UnRegisterApps(class RArray<unsigned int> const &)
+	?RegisterAppsL@CUpnpTmServer@@QAEXABV?$RPointerArray@VCUpnpRemotableApp@@@@@Z @ 22 NONAME ; void CUpnpTmServer::RegisterAppsL(class RPointerArray<class CUpnpRemotableApp> const &)
+	?NewL@CUpnpTmServerDeviceInfo@@SAPAV1@K@Z @ 23 NONAME ; class CUpnpTmServerDeviceInfo * CUpnpTmServerDeviceInfo::NewL(unsigned long)
+	?SetBtAddressL@CUpnpTmServerDeviceInfo@@QAEXABVTDesC8@@@Z @ 24 NONAME ; void CUpnpTmServerDeviceInfo::SetBtAddressL(class TDesC8 const &)
+	?SetMimeTypeL@CUpnpTmClientIconPref@@QAEXABVTDesC8@@@Z @ 25 NONAME ; void CUpnpTmClientIconPref::SetMimeTypeL(class TDesC8 const &)
+	?SetAllowedProfileIdListL@CUpnpRemotableApp@@QAEXABV?$RArray@I@@@Z @ 26 NONAME ; void CUpnpRemotableApp::SetAllowedProfileIdListL(class RArray<unsigned int> const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/eabi/terminalmodeserviceu.def	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,66 @@
+EXPORTS
+	_ZN13CUpnpTmServer12RegisterAppLEP17CUpnpRemotableApp @ 1 NONAME
+	_ZN13CUpnpTmServer13RegisterAppsLERK13RPointerArrayI17CUpnpRemotableAppE @ 2 NONAME
+	_ZN13CUpnpTmServer13UnRegisterAppEj @ 3 NONAME
+	_ZN13CUpnpTmServer14UnRegisterAppsERK6RArrayIjE @ 4 NONAME
+	_ZN13CUpnpTmServer14UpdateAppListLERK6RArrayIjE @ 5 NONAME
+	_ZN13CUpnpTmServer15GetRemotableAppEjRi @ 6 NONAME
+	_ZN13CUpnpTmServer16SetXmlSignatureLERK6TDesC8 @ 7 NONAME
+	_ZN13CUpnpTmServer16UpdateAppStatusLERK6RArrayIjE @ 8 NONAME
+	_ZN13CUpnpTmServer23UpdateUnusedProfileIdsLERK6RArrayIjE @ 9 NONAME
+	_ZN13CUpnpTmServer4NewLER23CUpnpTmServerDeviceInfoR21MUpnpTmServerObserver @ 10 NONAME
+	_ZN13CUpnpTmServer5StopLEv @ 11 NONAME
+	_ZN13CUpnpTmServer6StartLEv @ 12 NONAME
+	_ZN17CUpnpRemotableApp18SetAppDescriptionLERK6TDesC8 @ 13 NONAME
+	_ZN17CUpnpRemotableApp18SetResourceStatusLERK6TDesC8 @ 14 NONAME
+	_ZN17CUpnpRemotableApp20CreateTmInfoElementLEN18CUpnpTmInfoElement21TTerminalModeInfoTypeE @ 15 NONAME
+	_ZN17CUpnpRemotableApp24SetAllowedProfileIdListLERK6RArrayIjE @ 16 NONAME
+	_ZN17CUpnpRemotableApp4NewLEjRK6TDesC8 @ 17 NONAME
+	_ZN17CUpnpRemotableApp8AddIconLEP21CUpnpTerminalModeIcon @ 18 NONAME
+	_ZN18CUpnpTmInfoElement17AddTmInfoElementLERK6TDesC8S2_ @ 19 NONAME
+	_ZN21CUpnpTerminalModeIcon4NewLERK7TDesC16iiiRK6TDesC8 @ 20 NONAME
+	_ZN21CUpnpTmClientIconPref12SetMimeTypeLERK6TDesC8 @ 21 NONAME
+	_ZN21CUpnpTmClientIconPref4NewLEj @ 22 NONAME
+	_ZN23CUpnpTmServerDeviceInfo13SetBtAddressLERK6TDesC8 @ 23 NONAME
+	_ZN23CUpnpTmServerDeviceInfo14AddDeviceIconLEP21CUpnpTerminalModeIcon @ 24 NONAME
+	_ZN23CUpnpTmServerDeviceInfo14SetDeviceInfoLERK6TDesC8 @ 25 NONAME
+	_ZN23CUpnpTmServerDeviceInfo4NewLEm @ 26 NONAME
+	_ZTI13CUpnpTmServer @ 27 NONAME
+	_ZTI17CUpnpRemotableApp @ 28 NONAME
+	_ZTI17CUpnpTmServerImpl @ 29 NONAME
+	_ZTI18CUpnpAppFilterInfo @ 30 NONAME
+	_ZTI18CUpnpTmIconMapping @ 31 NONAME
+	_ZTI18CUpnpTmInfoElement @ 32 NONAME
+	_ZTI19CUpnpTmServerDevice @ 33 NONAME
+	_ZTI21CUpnpTerminalModeIcon @ 34 NONAME
+	_ZTI21CUpnpTmClientIconPref @ 35 NONAME
+	_ZTI22CUpnpRemotableAppStore @ 36 NONAME
+	_ZTI22CUpnpSvgImageConverter @ 37 NONAME
+	_ZTI22CUpnpTmFilteredAppList @ 38 NONAME
+	_ZTI23CUpnpTmAppServerService @ 39 NONAME
+	_ZTI23CUpnpTmServerDeviceInfo @ 40 NONAME
+	_ZTI25CUpnpIconConversionActive @ 41 NONAME
+	_ZTI27CUpnpTmClientProfileService @ 42 NONAME
+	_ZTI28CUpnpTmServerDeviceXmlParser @ 43 NONAME
+	_ZTI29CUpnpIconFileServeTransaction @ 44 NONAME
+	_ZTI32CUpnpTmServerDescriptionProvider @ 45 NONAME
+	_ZTV13CUpnpTmServer @ 46 NONAME
+	_ZTV17CUpnpRemotableApp @ 47 NONAME
+	_ZTV17CUpnpTmServerImpl @ 48 NONAME
+	_ZTV18CUpnpAppFilterInfo @ 49 NONAME
+	_ZTV18CUpnpTmIconMapping @ 50 NONAME
+	_ZTV18CUpnpTmInfoElement @ 51 NONAME
+	_ZTV19CUpnpTmServerDevice @ 52 NONAME
+	_ZTV21CUpnpTerminalModeIcon @ 53 NONAME
+	_ZTV21CUpnpTmClientIconPref @ 54 NONAME
+	_ZTV22CUpnpRemotableAppStore @ 55 NONAME
+	_ZTV22CUpnpSvgImageConverter @ 56 NONAME
+	_ZTV22CUpnpTmFilteredAppList @ 57 NONAME
+	_ZTV23CUpnpTmAppServerService @ 58 NONAME
+	_ZTV23CUpnpTmServerDeviceInfo @ 59 NONAME
+	_ZTV25CUpnpIconConversionActive @ 60 NONAME
+	_ZTV27CUpnpTmClientProfileService @ 61 NONAME
+	_ZTV28CUpnpTmServerDeviceXmlParser @ 62 NONAME
+	_ZTV29CUpnpIconFileServeTransaction @ 63 NONAME
+	_ZTV32CUpnpTmServerDescriptionProvider @ 64 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/group/bld.inf	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,30 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file provides the information required for building the
+*	       whole of a TM Service and its test component.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/terminalmodeservice.iby              CORE_MW_LAYER_IBY_EXPORT_PATH(terminalmodeservice.iby)
+
+PRJ_MMPFILES
+terminalmodeservice.mmp
+
+PRJ_TESTMMPFILES
+#include "../tsrc/upnptmservertest/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/group/terminalmodeservice.mmp	Tue Aug 31 16:06:48 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: This is the project specification file for Terminal Mode Service.
+*
+*/
+
+
+TARGET		       terminalmodeservice.dll
+TARGETTYPE	       dll
+UID			       0x1000008d 0x2002D1B8
+
+CAPABILITY         CAP_GENERAL_DLL
+
+USERINCLUDE	       ../inc 
+USERINCLUDE	       ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	       ../src
+
+SOURCE		       upnptmserver.cpp
+SOURCE		       upnptmserverimpl.cpp
+SOURCE             upnptmserverdeviceinfo.cpp
+SOURCE             upnpremotableapp.cpp
+SOURCE             upnptminfoelement.cpp
+SOURCE             upnptmserverdescriptionprovider.cpp  
+SOURCE             upnpterminalmodeicon.cpp 
+SOURCE             upnptmclienticonpref.cpp
+SOURCE             upnptmserverdevice.cpp 
+SOURCE             upnptmserverdevicexmlparser.cpp
+SOURCE             upnptmappserverservice.cpp
+SOURCE             upnptmclientprofileservice.cpp
+SOURCE             upnpremotableappstore.cpp
+SOURCE             upnptmfilteredapplist.cpp
+SOURCE             upnptmiconmapping.cpp
+SOURCE             upnpappfilterinfo.cpp 
+SOURCE             upnpiconfileservetransaction.cpp
+SOURCE             upnpsvgimageconverter.cpp
+SOURCE             upnpiconconversionactive.cpp 
+
+LIBRARY            upnpserviceframework.lib
+LIBRARY		       dlnawebserver.lib
+LIBRARY            upnpipserversutils.lib
+LIBRARY            upnpconnectionmanagersession.lib
+LIBRARY            insock.lib
+LIBRARY		       euser.lib
+LIBRARY		       efsrv.lib
+LIBRARY            xmlframework.lib
+LIBRARY            charconv.lib
+LIBRARY            bafl.lib
+LIBRARY            etelmm.lib
+LIBRARY            etel.lib
+LIBRARY            esock.lib 
+LIBRARY            svgengine.lib
+LIBRARY            imageconversion.lib
+LIBRARY            fbscli.lib 
+LIBRARY            gdi.lib
+
+DEFFILE            terminalmodeservice.def
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE_UDEBONLY
+#endif
+
+SMPSAFE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnpappfilterinfo.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,103 @@
+/**
+* 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: CUpnpAppFilterInfo class declaration
+*
+*/
+
+#ifndef __UPNPAPPFILTERINFO_H__
+#define __UPNPAPPFILTERINFO_H__
+
+// Include Files
+#include <e32base.h>
+#include "terminalmodeconsts.h"
+
+// Literals
+_LIT8(KProtocolId,          "protocolID");
+_LIT8(KFormat,              "format");
+_LIT8(KRemotingDirection,   "direction");
+_LIT8(KAppCategory,         "appCategory");
+_LIT8(KTrustLevel,          "trustLevel");
+_LIT8(KContCategory,        "contentCategory");
+_LIT8(KContentRules,        "contentRules");
+_LIT8(KAudioType,           "audioType");
+
+/**
+ *  This class stores the parsed information provided in the AppListingFilter
+ *  input argument of the GetApplicationList action.
+ *  Provides internal setter and getter methods.
+ *  Maintains a structure which holds the information such as which all optional 
+ *  elements are needed in the response and which all applications should go
+ *  in the response.
+ */
+class CUpnpAppFilterInfo : public CBase
+      {
+public: 
+      static  CUpnpAppFilterInfo* NewL();
+      ~CUpnpAppFilterInfo();
+      
+      /*
+       * Method is used to set the value for each key provided in the filter string as an input
+       * Returns error if the there is a mismatch of the key or key is not as per the GetApplicationList schema
+       * The default parameter( aDisplayInfoFlag ) is provided only to distinguish the child element "trustLevel" ( child element)
+       * of displayInfo element from "trustLevel" of appInfo element.
+       */
+      void SetFilterInfoL( const TDesC8& aKey, const TDesC8& aValue,
+                                  TTerminalModeErrorCode& aErr, TBool aDisplayInfoFlag = EFalse );
+      // inlined Getter methods
+      inline const TDesC8& AppName()const;
+      inline const TDesC8& AppDescription()const;
+      inline const TDesC8& MimeType()const;
+      inline const TDesC8& Width()const;
+      inline const TDesC8& Height()const;
+      inline const TDesC8& Depth()const;
+      inline const TDesC8& AllowedProfileIdList()const;
+      inline const TDesC8& ProtocolId()const;
+      inline const TDesC8& Format()const;
+      inline const TDesC8& Direction()const;
+      inline const TDesC8& AppCategory()const;
+      inline const TDesC8& AppTrustLevel()const;
+      inline const TDesC8& ContentCategory()const;
+      inline const TDesC8& ContentRules()const;
+      inline const TDesC8& ContentTrustLevel()const;
+      inline const TDesC8& AudioType()const;
+      inline const TDesC8& ResourceStatus()const;
+      inline const TDesC8& Signature()const;
+      
+private:
+      CUpnpAppFilterInfo( );
+      
+private:
+      HBufC8*                     iAppName;
+      HBufC8*                     iAppDesc;
+      HBufC8*                     iMimeType;
+      HBufC8*                     iWidth;
+      HBufC8*                     iHeight;
+      HBufC8*                     iDepth;
+      HBufC8*                     iAllowedIdList;
+      HBufC8*                     iProtocolId;
+      HBufC8*                     iFormat;
+      HBufC8*                     iDirection;
+      HBufC8*                     iAppCategory;
+      HBufC8*                     iAppTrustLevel;
+      HBufC8*                     iContCategory;
+      HBufC8*                     iContentRules;
+      HBufC8*                     iContTrustLevel;
+      HBufC8*                     iAudioType;
+      HBufC8*                     iRscStatus;
+      HBufC8*                     iSignature;
+      };
+
+#include "upnpappfilterinfo.inl"
+
+#endif  //__UPNPAPPFILTERINFO_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnpappfilterinfo.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,275 @@
+/**
+* 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 __UPNPAPPFILTERINFO_INL__
+#define __UPNPAPPFILTERINFO_INL__
+
+
+// -----------------------------------------------------------------------------
+// CAppFilterInfo::AppName
+// @return Returns the application name 
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::AppName()const
+    {
+    if ( iAppName )
+        {
+        return *iAppName;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::AppDescription
+// @return Returns the app description
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::AppDescription()const
+    {
+    if ( iAppDesc )
+        {
+        return *iAppDesc;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::MimeType
+// @return Returns the mimetype of the icon
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::MimeType()const
+    {
+    if ( iMimeType )
+        {
+        return *iMimeType;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::Width
+// @param[out] aFlag True or false
+// @return Returns the width value of the icon
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::Width()const
+    {
+    if ( iWidth )
+        {
+        return *iWidth;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::Height
+// @param[out] aFlag True or false
+// @return Returns the height value of the icon
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::Height()const
+    {
+    if ( iHeight )
+        {
+        return *iHeight;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::Depth
+// @return Returns the depth value of the icon
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::Depth()const
+    {
+    if ( iDepth )
+        {
+        return *iDepth;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::AllowedProfileId
+// @return Returns the depth value of the icon
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::AllowedProfileIdList()const
+    {
+    if ( iAllowedIdList )
+        {
+        return *iAllowedIdList;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::ProtocolId
+// @return Returns the protocol name 
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::ProtocolId()const
+    {
+    if ( iProtocolId )
+        {
+        return *iProtocolId;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::Format
+// @return Returns the format of remoting info element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::Format()const
+    {
+    if ( iFormat )
+        {
+        return *iFormat;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::Direction
+// @return Returns the direction of remoting info 
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::Direction()const
+    {
+    if ( iDirection)
+        {
+        return *iDirection;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::AppCategory
+// @return Returns the category of application for appInfo element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::AppCategory()const
+    {
+    if ( iAppCategory )
+        {
+        return *iAppCategory;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::AppTrustLevel
+// @return Returns the trust level of application for appInfo element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::AppTrustLevel()const
+    {
+    if ( iAppTrustLevel )
+        {
+        return *iAppTrustLevel;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::ContentCategory
+// @return Returns the category of the content for display info element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::ContentCategory()const
+    {
+    if ( iContCategory )
+        {
+        return *iContCategory;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::ContentCategory
+// @return Returns the content rules for display info element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::ContentRules()const
+    {
+    if ( iContentRules )
+        {
+        return *iContentRules;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::ContentTrustLevel
+// @return Returns the trust level of the for display info element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::ContentTrustLevel()const
+    {
+    if ( iContTrustLevel )
+        {
+        return *iContTrustLevel;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::AudioType
+// @return Returns the type of audio for audio info element
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::AudioType()const
+    {
+    if ( iAudioType )
+        {
+        return *iAudioType;
+        }
+    return KNullDesC8();
+    }
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::ResourceStatus
+// @return Returns the protocol name 
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::ResourceStatus()const
+    {
+    if ( iRscStatus )
+        {
+        return *iRscStatus;
+        }
+    return KNullDesC8();
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpAppFilterInfo::Signature
+// @return Returns the protocol name 
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpAppFilterInfo::Signature()const
+    {
+    if ( iSignature )
+        {
+        return *iSignature;
+        }
+    return KNullDesC8();
+    }
+
+#endif   //__UPNPAPPFILTERINFO_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnpiconconversionactive.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,51 @@
+/**
+* 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: CUpnpIconConversionActive class declaration.
+*
+*/
+
+#ifndef __UPNPICONCONVERSIONACTIVE_H__
+#define __UPNPICONCONVERSIONACTIVE_H__
+
+// Include Files
+#include <imageconversion.h>
+
+/** 
+ * Class encapsulates an active object (AO) which handles the actual image conversion 
+ * in the new thread created.
+ */ 
+class CUpnpIconConversionActive: public CActive 
+    {
+public:
+    static CUpnpIconConversionActive* NewL( RFile& aBitmapFile );
+    ~CUpnpIconConversionActive();
+    
+    void Convert( CFbsBitmap& aBitmap );
+    TInt FetchError();
+    void RunL();
+    void DoCancel();
+    
+private :
+    CUpnpIconConversionActive();
+    void ConstructL( RFile& aBitmapFile );
+        
+private:
+    /**
+     * CImageEncoder class provides functions that convert image data held 
+     * in CFbsBitmap objects into well know formats( "bitmap" in this case ) 
+     */
+    CImageEncoder*                iEncoder; 
+    };
+
+#endif  //__UPNPICONCONVERSIONACTIVE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnpiconfileservetransaction.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,49 @@
+/**
+* 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: CUpnpIconFileServeTransaction class declaration
+*
+*/
+
+#ifndef __UPNPICONFILESERVETRANSACTION_H_
+#define __UPNPICONFILESERVETRANSACTION_H_
+
+#include <upnphttpservertransaction.h>
+
+/**
+* Class derives from CUpnpHttpServerTransaction base class. It sets the actual filepath 
+* which have to be served for http-get request
+*/
+class CUpnpIconFileServeTransaction: public CUpnpHttpServerTransaction
+    {
+public:
+    ~CUpnpIconFileServeTransaction();  
+    
+    static CUpnpIconFileServeTransaction* NewL( const TDesC& aOutFilePath, RFs& aIconSession );
+
+public:
+    virtual void OnCallbackL( TUpnpHttpServerEvent aEvent );
+    
+protected:
+    CUpnpIconFileServeTransaction( RFs& aIconSession );
+    void ConstructL( const TDesC& aOutFilePath  );    
+    
+private:
+    void DoCallbackL( TUpnpHttpServerEvent aEvent ); 
+       
+private:
+    RBuf   iOutFilePath;
+    RFs&   iIconFileSession ;
+    };
+
+#endif  // __UPNPICONFILESERVETRANSACTION_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnpremotableappstore.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,46 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpRemotableAppStore class declaration
+*
+*/
+
+#ifndef __UPNPREMOTABLEAPPSTORE_H__
+#define __UPNPREMOTABLEAPPSTORE_H__
+
+#include "upnpremotableapp.h"
+
+/**
+* Container class for all the remotable applications which have been registered 
+* with the terminal mode service. It provides an easy access to the list of remotable apps
+*/
+class CUpnpRemotableAppStore : public CBase
+    {
+public:
+    static CUpnpRemotableAppStore* NewL();
+	void AddRemotableAppL( CUpnpRemotableApp* aApp );
+	TInt RemoveRemotableApp( TUint aAppId );
+	~CUpnpRemotableAppStore();
+	CUpnpRemotableApp& FetchRemotableApp( TInt aAppIndex )const;
+	const RArray<TUint>& AppIdArray()const;
+
+private:
+	CUpnpRemotableAppStore();
+	
+private:
+	RPointerArray<CUpnpRemotableApp>   iRemotableAppArray;
+	RArray<TUint>                      iAppIdArray;
+    };
+
+
+#endif  // __UPNPREMOTABLEAPPSTORE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnpsvgimageconverter.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,71 @@
+/**
+* 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: CUpnpSvgImageConverter class declaration.
+*
+*/
+
+#ifndef __UPNPSVGIMAGECONVERTER_H__
+#define __UPNPSVGIMAGECONVERTER_H__
+
+// Include Files
+#include <SVGEngineInterfaceImpl.h>
+
+/**
+ * CUpnpSvgImageConverter class acts as an intermediate between the invoker and the
+ * actual converter.Class encapsulates svg to bitmap conversion process.
+ * Does all the pre-processing needed before invoking actual conversion API.
+ * It takes svg file as an input and provides bmp ( converted ) file as an output.
+ * This class is responsible for creating a new thread and allocating resources to it.
+ * The icon file conversion happens in the new thread being created.
+ */
+class CUpnpSvgImageConverter : public CBase                      
+    {
+public:
+    /**
+    * Two-phased constructor
+    * @param aIconWidth width of the requested icon
+    * @param aIconHeight height of the requested icon
+    */
+    static CUpnpSvgImageConverter* NewL( TInt aIconWidth, TInt aIconHeight );
+    /**
+     * Prepares the DOM for given SVG file, creates a new thread and returns
+     * the converted icon(bmp) file path
+     */ 
+    void ConvertToBitmapL( const TDesC& aSvgFile, RBuf& aBitmapFile );
+    ~CUpnpSvgImageConverter();
+    CFbsBitmap& BitmapObject()const;
+    //static thread method serving as thread's main function
+    static TInt ImageConverter( TAny* aParam );
+    //Leaving variant of thread function
+    static void ImageConverterL( CUpnpSvgImageConverter& aSvgConverter ); 
+  
+private: 
+    // Constructors
+    CUpnpSvgImageConverter( );
+    void ConstructL( TInt aIconWidth, TInt aIconHeight );
+    // Thread creation method
+    void StartThreadL( );
+    // "Getter" method to fetch file path
+    const TDesC& Filepath( )const;
+        
+private:
+    RFbsSession                  iFbsSession;
+    RFs                          iFileSession; 
+    CFbsBitmap*                  iMask;
+    CSvgEngineInterfaceImpl*     iSvgModule;
+    RBuf                         iBitMapFilePath;
+    CFbsBitmap*                  iBitmap;
+    };
+
+#endif // __UPNPSVGIMAGECONVERTER_H__ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmappserverservice.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,110 @@
+/**
+* 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: CUpnpTmAppServerService class declaration
+*
+*/
+
+#ifndef __UPNPTMAPPSERVERSERVICE_H__
+#define __UPNPTMAPPSERVERSERVICE_H__
+
+
+// Include Files
+#include <upnpserviceimplementation.h>
+#include <upnphttpserverobserver.h>
+#include <upnphttpservertransactioncreator.h>
+#include <upnpcommonupnplits.h>
+#include <upnpsettings.h>
+#include <upnphttpserversession.h>
+#include <upnphttpserverruntime.h>
+
+// FORWARD DECLARATIONS
+class CUPnPTmServerDevice;
+class CUpnpTmServerImpl;
+
+
+// CLASS DECLARATION
+
+/**
+* TerminalMode Application Server Service class. It encapsulates all the major actions 
+* needed for accessing and controlling the remotable apps from the Control Point.
+*
+*/
+
+class CUpnpTmAppServerService: public CUpnpServiceImplementation, 
+                               public MUpnpHttpServerTransactionCreator,
+                               public MUpnpHttpServerObserver
+    {               
+public: // Constructors and destructors
+    
+    /**
+    * Two-phased constructor.
+    * @param aService Parent service 
+    */
+    static CUpnpTmAppServerService* NewL( CUpnpDevice& aUpnpDevice, const TDesC& aDescriptionPath , 
+                                                                CUpnpTmServerImpl& aTmServerImpl );
+                                      
+    /**
+    * Destructor function called automatically from the destructor of a 
+    * derived class
+    **/
+    ~CUpnpTmAppServerService();
+               
+public: //from CUpnpServiceImplementation
+    /**
+    * This functions is a entry point for actions. See coments in base class
+    */
+    void ActionReceivedLD( CUpnpAction* aAction );
+    void AppStatusUpdateEventL( const TDesC8& aStatusUpdateBuffer );    
+    void AppListUpdateEventL( const TDesC8& aListUpdateBuffer );  
+
+public: //from MUpnpHttpServerTransactionCreator
+    void NewTransactionL( const TDesC8& aMethod, const TDesC8& aUri,    
+                       const TInetAddr& aSender, CUpnpHttpServerTransaction*& aResultTrans );
+        
+private: //From MUpnpHttpServerObserver
+    void HttpEventLD( CUpnpHttpMessage* aMessage );
+   
+private:      
+    TUpnpErrorCode GetAppListActionL( CUpnpAction* aAction );
+    TUpnpErrorCode LaunchAppActionL( CUpnpAction* aAction );
+    TUpnpErrorCode TerminateAppActionL( CUpnpAction* aAction );
+    TUpnpErrorCode GetAppStatusActionL( CUpnpAction* aAction );
+
+private: // Constructors
+    
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTmAppServerService( CUpnpDevice& aUpnpDevice, CUpnpTmServerImpl& aTmServerImpl );
+
+    /**
+    * Second phase of the constructor.
+    * Initialises a DOM tree.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL(const TDesC& aDescriptionPath );
+                    
+    void ConstructHttpL( );
+    TInt ConvertDescriptorToInt( const TDesC8& aDes, TUint& aErr );
+    
+private:
+    CUpnpHttpServerSession*     iHttpServerSession;
+    CUpnpDevice&                iUpnpDevice;
+    CUpnpTmServerImpl&          iTmServerImpl;
+    };
+
+#endif  // __UPNPTMAPPSERVERSERVICE_H__
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmclientprofileservice.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,93 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmClientProfileService class declaration
+*
+*/
+
+#ifndef __UPNPTMCLIENTPROFILESERVICE_H__
+#define __UPNPTMCLIENTPROFILESERVICE_H__
+
+
+// Include Files
+#include <upnpserviceimplementation.h>
+#include <upnphttpserverobserver.h>
+#include <upnphttpservertransactioncreator.h>
+#include <upnpcommonupnplits.h>
+#include <upnpsettings.h>
+#include <upnphttpserversession.h>
+#include <upnphttpserverruntime.h>
+
+// FORWARD DECLARATIONS
+class CUPnPTmServerDevice;
+class CUpnpTmServerImpl;
+
+// CLASS DECLARATION
+
+/**
+ * TerminalMode Client Profile Service class. It encapsulates all the actions related to the client 
+ * profile and their related state variables.
+ */
+class CUpnpTmClientProfileService: public CUpnpServiceImplementation
+    {               
+public: // Constructors and destructors
+    /**
+    * Two-phased constructor.
+    * @param aService Parent service 
+    */
+    static CUpnpTmClientProfileService* NewL( CUpnpDevice& aUpnpDevice, const TDesC& aDescriptionPath , 
+                                                                     CUpnpTmServerImpl& aTmServerImpl );
+                                      
+    /**
+    * Destructor function called automatically from the destructor of a 
+    * derived class
+    **/
+    ~CUpnpTmClientProfileService();
+               
+public: //from CUpnpServiceImplementation
+    /**
+    * This functions is a entry point for actions. See coments in base class
+    */
+    void ActionReceivedLD( CUpnpAction* aAction );
+ 
+    void UnUsedProfileIdEventL(const TDesC8& aUnusedProfileIdBuffer);   
+   
+private:  
+    // Actions supported by the client profile service
+    TUpnpErrorCode GetMaxNumProfilesActionL( CUpnpAction* aAction );
+    TUpnpErrorCode SetClientProfileActionL( CUpnpAction* aAction );
+    TUpnpErrorCode GetClientProfileActionL( CUpnpAction* aAction );
+
+private: // Constructors 
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTmClientProfileService( CUpnpDevice& aUpnpDevice, 
+                                    CUpnpTmServerImpl& aTmServerImp );
+    /**
+    * Second phase of the constructor.
+    * Initialises a DOM tree.
+    * By default Symbian 2nd phase constructor is private.
+    * @param service Parent service
+    */
+    void ConstructL(const TDesC& aDescriptionPath );
+    
+private:
+    CUpnpHttpServerSession*     iHttpServerSession;
+    CUpnpDevice&                iUpnpDevice;
+    CUpnpTmServerImpl&          iTmServerImpl;
+    };
+
+#endif  // __UPNPTMCLIENTPROFILESERVICE_H__
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmfilteredapplist.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,66 @@
+/**
+* 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: CUpnpTmFilteredAppList class declaration
+*
+*/
+
+#ifndef __UPNPTMFILTEREDAPPLIST_H__
+#define __UPNPTMFILTEREDAPPLIST_H__
+
+
+//System Includes
+#include <inetprottextutils.h>
+
+//User Includes
+#include "upnpterminalmodeicon.h"
+#include "upnpremotableappstore.h"
+#include "upnpappfilterinfo.h"
+
+//Forward Declaration
+class CUpnpTmServerImpl;
+
+
+/**
+ * Constructs the filtered GetApplicationList action Response.
+ * Applies the AppListingFilter criteria while creating the soap 
+ * response buffer.
+ *
+ */
+class CUpnpTmFilteredAppList : public CBase 
+    {
+public:
+    static CUpnpTmFilteredAppList* NewL( CUpnpTmServerImpl& aTmServerImpl ); 
+	
+	~CUpnpTmFilteredAppList();	
+    void ParseAppFilterStringL( const TDesC8& aAppFilter, TTerminalModeErrorCode& aErr );
+    void ConstructFilteredGetAppListResponseL( TInt aAppIndex );
+    const TDesC8& SignatureElement()const;
+    
+private:
+    CUpnpTmFilteredAppList( CUpnpTmServerImpl& aTmServerImpl );
+    void ConstructL( );
+    
+    TBool TerminalModeInfoMatchingL( const CUpnpTmInfoElement& aTmInfoElement )const;
+    TBool TmInfoElementMatchingL( const CUpnpTmInfoElement& aTmInfoElement,TInt aIndex )const;                                                                       
+    void IconMatchingL( TInt aAppIndex );              
+    void ConstructFilteredResponseL( TInt aAppIndex );                              
+    TBool IconLookUp( CUpnpTerminalModeIcon& aIcon );
+    const TDesC8& RemoveWhiteSpace( TPtrC8& aData );
+
+private:
+    CUpnpAppFilterInfo*                   iFilterInfo;
+    CUpnpTmServerImpl&                    iTmServerImpl;
+    };
+
+#endif  //  __UPNPTMFILTEREDAPPLIST_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmiconmapping.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,58 @@
+/**
+* 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: CUpnpTmIconMapping class declaration.
+*
+*/
+
+#ifndef __UPNPTMICONMAPPING_H__
+#define __UPNPTMICONMAPPING_H__
+
+// Include Files
+#include <e32base.h>
+#include <badesca.h>
+#include "upnptmclienticonpref.h"
+
+// Constants
+const TInt KExpectedMaxIconParms = 20;
+
+/**
+ * Class maintains a mapping between application icon filepath and its URL. It also 
+ * determines whether the conversion is needed for a particular requested 
+ * application icon( http request ) and finalizes the dimensions of the icon which needs 
+ * to be served
+ */
+class CUpnpTmIconMapping : public CBase
+    {
+public:
+    static CUpnpTmIconMapping* NewL( );
+    ~CUpnpTmIconMapping();
+    
+public:
+    void AddIconFileInfoL( const TDesC8& aUrl, const TDesC& aPath, TInt aWidth, TInt aHeight );
+    TInt GetSvgIconPath( const TDesC8& aUrl,RBuf& aSvgFilePath );
+    TBool IsConversionNeeded( TInt aIndex, const CUpnpTmClientIconPref& aClientIconPref,
+                                                       TInt& aIconWidth, TInt& aIconHeight );
+    
+private:
+    CUpnpTmIconMapping();
+    void ConstructL();
+
+private:
+    CDesC8Array*              iFileUrlArray;
+    CDesCArray*               iFilePathArray;
+    RArray<TInt>              iWidthArray;
+    RArray<TInt>              iHeightArray;
+    };
+
+#endif // __UPNPTMICONMAPPING_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmserverdescriptionprovider.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,76 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmServerDescriptionProvider class declaration
+*
+*/
+
+#ifndef __UPNPTMSERVERDESCRIPTIONPROVIDER_H__
+#define __UPNPTMSERVERDESCRIPTIONPROVIDER_H__
+
+// Include Files
+#include <e32base.h>
+#include <upnpdevicedescriptionrequest.h>
+#include <upnpdevicedescriptionprovider.h>
+#include <upnpfileutils.h>
+#include <upnpcons.h>
+
+const TUint KForwardSlash = '/';
+
+/**
+ * CUpnpTmServerDescriptionProvider 
+ * Provides description of device and its services, and icons. 
+ */
+class CUpnpTmServerDescriptionProvider : public CBase,
+                                         public MUpnpDeviceDescriptionProvider
+    {
+public:
+    // Destructor.
+    ~CUpnpTmServerDescriptionProvider();
+
+    // Two-phased constructor.
+    static CUpnpTmServerDescriptionProvider* NewL();
+    
+private:    // from MUpnpDeviceDescriptionProvider
+    
+    virtual TInt OnDeviceDescription( CUpnpDeviceDescriptionRequest& aRequest );
+    
+    virtual TInt OnServiceDescription( CUpnpDeviceDescriptionRequest& aRequest );    
+    
+    virtual TInt OnIcon( CUpnpDeviceDescriptionRequest& aRequest );            
+    
+    virtual TInt GetFile( const TDesC8& aUri, RFile& aFile ); 
+
+private:
+     // Constructor for performing 1st stage construction
+    CUpnpTmServerDescriptionProvider();
+
+    //Default constructor for performing 2nd stage construction
+    void ConstructL();
+
+    /**
+     * Main function to service requests.
+     * @param aRequest request to service
+     * @return error code
+     */
+    TInt OnRequest( CUpnpDeviceDescriptionRequest& aRequest );
+
+    void OnRequestL( const TDesC8& aUrlPath, const TDesC8& aFileName );
+
+private:
+    // File server session used to open file
+    RFs                                  iFs;
+    TBuf<UpnpString::KMaxFilenameLength> iFilePath;  
+    };
+
+#endif // __UPNPTMSERVERDESCRIPTIONPROVIDER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmserverdevice.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,75 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmServerDevice class declaration
+*
+*/
+
+#ifndef __UPNPTMSERVERDEVICE_H__
+#define __UPNPTMSERVERDEVICE_H__
+
+// System Includes
+#include <in_sock.h>
+#include <upnpdeviceimplementation.h>
+#include <upnpdevicedescriptionstore.h>
+
+// User Includes
+#include "upnptmappserverservice.h"
+#include "upnptmclientprofileservice.h"
+#include "upnptmserverdevicexmlparser.h"
+#include "upnptmserverdescriptionprovider.h"
+
+
+// CLASS DECLARATION
+
+// UPnP Terminal Mode Server Device container.
+
+class CUpnpTmServerDevice : public CBase
+    {
+public:
+     // Two-phased constructor.
+    static CUpnpTmServerDevice* NewL( CUpnpTmServerDeviceInfo& aDeviceInfo, 
+                                            CUpnpTmServerImpl& aTmServerImpl ); 
+     // Destructor.     
+    ~CUpnpTmServerDevice();
+
+public:
+    // Starts TM Server - Device, Service
+    void StartTmServerDeviceL();
+    // Stops TM Server - Device, Service
+    void StopTmServerDeviceL();
+    //Event handling methods invoked by CUpnpTmServerImpl object
+    void AppStatusUpdateL( const TDesC8& aStatusEventBuffer );
+    void AppListUpdateL( const TDesC8& aListEventBuffer );
+    void UnUsedProfileIdUpdateL( const TDesC8& aUnusedProfileIdBuffer );
+
+private:
+    // Constructor
+    CUpnpTmServerDevice();
+    // Perform the second phase construction of a CUpnpTmServerDevice object
+    void ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo,CUpnpTmServerImpl& aTmServerImpl );
+
+private:
+    // iDevice TerminalMode Server Device 
+    CUpnpDeviceImplementation*              iDevice;
+    CUpnpTmAppServerService*                iTmAppServerService;
+    CUpnpTmClientProfileService*            iTmClientProfileService;
+    // Provides files for description part
+    CUpnpTmServerDescriptionProvider*       iDescriptionProvider; 
+    // Services device description
+    CUpnpDeviceDescriptionStore*            iDescriptionStore;
+    CUpnpTmServerDeviceXmlParser*           iXmlParser;
+    TBool                                   iIsStarted;
+    };
+
+#endif //__UPNPTMSERVERDEVICE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmserverdevicexmlparser.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,97 @@
+/**
+* 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: CUpnpTmServerDeviceXmlParser class declaration
+*
+*/
+
+#ifndef __UPNPTMSERVERDEVICEXMLPARSER_H__
+#define __UPNPTMSERVERDEVICEXMLPARSER_H__
+
+// System Includes
+#include <xml/parser.h>
+#include <xml/contenthandler.h>
+#include <f32file.h>
+#include <etelmm.h>
+#include <ctsy/mmtsy_names.h>
+#include <upnpcons.h>
+
+// User Include
+#include "upnptmserverdeviceinfo.h"
+
+// Constants
+const TUint KBufSize      = 20480;
+const TUint KMaxBufLength = 255;
+const TUint KDirectorySeparator = '\\';
+
+using namespace Xml;
+
+/**
+ *  This class takes the root device content as xml formatted buffer which serves as placeholders 
+ *  for many element values as an input and then constructs the complete device description 
+ *  xml file and service xml files which are published over the network
+ */
+class CUpnpTmServerDeviceXmlParser: public CBase,
+						            public MContentHandler						
+	{
+public:
+	static CUpnpTmServerDeviceXmlParser* NewL( CUpnpTmServerDeviceInfo& aDeviceInfo );
+	~CUpnpTmServerDeviceXmlParser();
+	void StartL();
+	inline const TDesC& DevicePath();
+	inline const TDesC& AppServerSrvPath();
+	inline const TDesC& ClientProfileSrvPath();
+	inline const TDesC8& DescriptionUri();
+	
+private:
+	CUpnpTmServerDeviceXmlParser( CUpnpTmServerDeviceInfo& aDeviceInfo );
+	void ConstructL( );
+	void DeleteDirectory();
+	
+private: // From MContentHandler
+	void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode);
+	void OnEndDocumentL(TInt aErrorCode);
+	void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode);
+	void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
+	void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
+	void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode);
+	void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
+	void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
+	void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
+	void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode);
+	inline void OnError(TInt aErrorCode);
+	inline TAny* GetExtendedInterface(const TInt32 aUid);
+		
+private:
+	RBuf8                                iAppServerSrvDescription;
+	RBuf8                                iClientProfSrvDescription;
+	RBuf8		                         iReadBuf;
+	RBuf8		                         iDeviceDescription;
+	CParser* 	                         iParser;
+	RBuf		                         iDescFilePath;
+	RBuf		                         iAppServerSrvFilePath;
+	RBuf                                 iClientProfSrvFilePath;
+	RBuf8                                iDescriptionUri;
+	RFs                                  iFs;
+	RBuf                                 iDeviceDir;
+	RBuf                                 iIconDirectory;
+    RMobilePhone                         iPhone;
+    RTelServer                           iEtelSrv;
+    RMobilePhone::TMobilePhoneIdentityV1 iPhoneId;
+    CUpnpTmServerDeviceInfo&             iDeviceInfo;
+    CFileMan*                            iFileMan; 
+	};	
+
+#include "upnptmserverdevicexmlparser.inl"
+
+#endif  //__UPNPTMSERVERDEVICEXMLPARSER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmserverdevicexmlparser.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,79 @@
+/**
+* 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: CUpnpTmServerDeviceXmlParser INL file.
+*
+*/
+
+#ifndef __UPNPTMSERVERDEVICEXMLPARSER_INL__
+#define __UPNPTMSERVERDEVICEXMLPARSER_INL__
+
+
+// -----------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnError 
+// -----------------------------------------------------------------------------
+//
+inline void CUpnpTmServerDeviceXmlParser::OnError(TInt /*aErrorCode*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::GetExtendedInterface 
+// -----------------------------------------------------------------------------
+//
+inline TAny* CUpnpTmServerDeviceXmlParser::GetExtendedInterface(const TInt32 /*aUid*/)
+    {
+    return NULL;    
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::DevicePath 
+// @return Returns the device description filepath
+// -----------------------------------------------------------------------------
+//
+inline const TDesC& CUpnpTmServerDeviceXmlParser::DevicePath()
+    {
+    return iDescFilePath;   
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::AppServerSrvPath 
+// @return Returns TmAppServerService filepath
+// -----------------------------------------------------------------------------
+//
+inline const TDesC& CUpnpTmServerDeviceXmlParser::AppServerSrvPath()
+    {
+    return iAppServerSrvFilePath;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::ClientProfileSrvPath
+// @return Returns TmClientProfileService filepath
+// -----------------------------------------------------------------------------
+//
+inline const TDesC& CUpnpTmServerDeviceXmlParser::ClientProfileSrvPath()
+    {
+    return iClientProfSrvFilePath;
+    }
+
+// -----------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::DescriptionUri 
+// @return Returns the device description URI
+// -----------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpTmServerDeviceXmlParser::DescriptionUri()
+    {
+    return iDescriptionUri;
+    }
+
+#endif // __UPNPREMOTEUIDEVICEXMLPARSER_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/inc/upnptmserverimpl.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,130 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmServerImpl class declaration
+*
+*/
+
+#ifndef __UPNPTMSERVERIMPL_H__
+#define __UPNPTMSERVERIMPL_H__
+
+// System Includes
+#include <upnpsettings.h>
+#include <upnphttpserversession.h>
+#include <utf.h>
+
+// User Includes
+#include "upnptmserver.h"
+#include "upnptminfoelement.h"
+#include "upnptmserverdevice.h"
+#include "upnpremotableappstore.h"
+#include "upnptmfilteredapplist.h"
+#include "upnptmiconmapping.h"
+#include "upnpsvgimageconverter.h"
+
+//Literals
+_LIT8(KStartApp,                 "&lt;app&gt;");
+_LIT8(KEndApp,                   "&lt;/app&gt;");
+_LIT8(KStartIconList,            "&lt;iconList&gt;");
+_LIT8(KEndIconList,              "&lt;/iconList&gt;");
+_LIT8(KStartNameDesc,            "&lt;description&gt;");
+_LIT8(KEndNameDesc,              "&lt;/description&gt;");
+_LIT8(KWildCard,                 "*");
+_LIT8(KAtToken,                  "@");
+
+//Constants
+const TUint KActionBufferLength  = 1000;
+
+/**
+ * Implementation class ( body ) for CUpnpTmServer class
+ *
+ */
+class CUpnpTmServerImpl : public CBase 
+    {
+public:
+    static CUpnpTmServerImpl* NewL( CUpnpTmServerDeviceInfo& aDeviceInfo, 
+                                    MUpnpTmServerObserver& aTmServerObserver );
+    
+    virtual ~CUpnpTmServerImpl();   
+
+    void RegisterAppL( CUpnpRemotableApp* aRemotableApp );
+    void RegisterAppsL(const RPointerArray<CUpnpRemotableApp>& aRemotableAppList);
+    TInt UnRegisterApp( TUint aAppId );
+    TInt UnRegisterApps( const RArray<TUint>& aAppIdArray );
+                                                                  
+    void SetXmlSignatureL( const TDesC8& aSignature );  
+    const TDesC8& XmlSignature()const;
+    // Start and Stop methods
+    void StartDeviceL();
+    void StopDeviceL();
+    CUpnpRemotableApp& GetRemotableApp( TUint aAppId, TInt& aErr );
+    void GenerateUrlComponents( CUpnpHttpServerSession& aHttpServerSession );
+    const TDesC8& ConvertIntToDescriptor( TInt aIntVal );
+    
+public:
+    //Action handling methods
+    const TDesC8& GetApplicationListL( const TDesC8& aAppListFilter,
+                                   TUint aProfileId, TTerminalModeErrorCode& aErr );
+    TTerminalModeErrorCode LaunchApp( TUint aAppId, TUint aProfileId, RBuf8& aUrl ); 
+    TTerminalModeErrorCode TerminateApp( TUint aAppId, TUint aProfileId );
+    void GetAppStatusL( const TDesC8& aAppIdBuffer,RBuf8& aStatusType,
+                                              TTerminalModeErrorCode& aErr );
+    TTerminalModeErrorCode GetMaxNumProfiles( TUint& aNumMaxProfiles );
+    TTerminalModeErrorCode SetClientProfile( TUint aProfileId, const TDesC8& aInputClientProfile,
+                                                                         RBuf8& aResultProfile );
+    TTerminalModeErrorCode GetClientProfile( TUint aProfileId, RBuf8& aClientProfile );
+    
+    //Event Notification methods
+    void UpdateAppStatusL( const RArray<TUint>& aUpdatedAppIdList );
+    void UpdateAppListL( const RArray<TUint>& aUpdatedAppIdList );
+    void UpdateUnusedProfileIdsL( const RArray<TUint>& aUnusedProfileIdList );
+    
+    // Application icon fetching method
+    void GetIconInfoL( const TDesC8& aUrl, CUpnpHttpServerTransaction*& aResultTrans );
+    
+private:
+    CUpnpTmServerImpl( MUpnpTmServerObserver& aTmServerObserver );
+    void ConstructL(  CUpnpTmServerDeviceInfo&  aDeviceInfo );
+    void RestoreIap();
+    
+    void AppendDataL( const TDesC8& aData );
+    TTerminalModeErrorCode AuthorizeApp( TUint aAppId );
+    void ConstructActionResponseBufferL( TInt aAppIndex ); 
+    void ConstructLeadingSoapBufferL( TInt aAppIndex );
+    void SetRemotableAppIconInfoL(  const CUpnpTerminalModeIcon& aTmIcon );
+    void SetAllowedProfileIdListL( TInt aAppIndex );
+    void SetTerminalModeInfoElementL( const CUpnpTmInfoElement& aTmInfoElement );
+    void SetResourceStatusL( TInt aAppIndex );
+    void CreateGetAppStatusResponseL( TUint aAppId, TTerminalModeErrorCode& aErr ); 
+    void CreateEventMessageL( const RArray<TUint>& aIdList );
+    friend class CUpnpTmFilteredAppList;
+ 
+private:
+    CUpnpTmServerDevice*                  iTmServerDevice;
+    MUpnpTmServerObserver&                iTmServerObserver;
+    RBuf8                                 iResponseBuf;
+    TBuf8<UpnpString::KShortStringLength> iAddrBuf;
+    TBuf8<UpnpString::KShortStringLength> iPortBuf;   
+    RBuf8                                 iXmSignature;
+    CUpnpRemotableAppStore*               iAppStore;
+    RFs                                   iIconFileSession;
+    CUpnpTmFilteredAppList*               iFilteredAppList;
+    TBuf8<UpnpString::KShortStringLength> iBufVal;
+    CUpnpSettings*                        iIapSetting;
+    TInt                                  iIapId;   // Original IAP ID used by DLNA  
+    TUint                                 iProfileId;
+    // Mapping between application icon filepath and its URL
+    CUpnpTmIconMapping*                   iIconMapping;
+    };
+
+#endif  // __UPNPTMSERVERIMPL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/rom/terminalmodeservice.iby	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,29 @@
+/**
+* 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:  IBY file for Terminal Mode Service subsystem
+*
+*/
+
+
+#ifndef __TERMINALMODESERVICE_IBY__
+#define __TERMINALMODESERVICE_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\terminalmodeservice.dll   \sys\bin\terminalmodeservice.dll
+
+
+
+#endif // __TERMINALMODESERVICE_IBY__
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpappfilterinfo.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,254 @@
+/**
+* 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: CUpnpAppFilterInfo class implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpappfilterinfo.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpappfilterinfoTraces.h"
+#endif
+
+//Literals
+_LIT8(KAppName,             "name");
+_LIT8(KAppDesc,             "description");
+_LIT8(KMimeType,            "mimetype");
+_LIT8(KWidth,               "width");
+_LIT8(KHeight,              "height");
+_LIT8(KDepth,               "depth");
+_LIT8(KAllowedProfileIds,   "allowedProfileIDs");
+_LIT8(KRscStatus,           "resourceStatus");
+_LIT8(KSignature,           "signature");
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpAppFilterInfo::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpAppFilterInfo* CUpnpAppFilterInfo::NewL( )
+    {
+    OstTraceFunctionEntry0( CUPNPAPPFILTERINFO_NEWL_ENTRY );
+    return ( new (ELeave) CUpnpAppFilterInfo() );   
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpAppFilterInfo::CUpnpAppFilterInfo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpAppFilterInfo::CUpnpAppFilterInfo( )
+    {
+    iAppName = NULL;
+    iAppDesc = NULL;
+    iMimeType = NULL;
+    iWidth = NULL;
+    iHeight = NULL;
+    iDepth = NULL;
+    iAllowedIdList = NULL;
+    iProtocolId = NULL;
+    iFormat = NULL;
+    iDirection = NULL;
+    iAppCategory = NULL; 
+    iAppTrustLevel = NULL;
+    iContCategory = NULL;
+    iContentRules = NULL;
+    iContTrustLevel = NULL;
+    iAudioType = NULL;
+    iRscStatus = NULL;
+    iSignature = NULL;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpAppFilterInfo::~CUpnpAppFilterInfo
+// C++ default destructor 
+// ---------------------------------------------------------------------------------
+//
+CUpnpAppFilterInfo::~CUpnpAppFilterInfo()
+    {
+    OstTraceFunctionEntry0( CUPNPAPPFILTERINFO_CUPNPAPPFILTERINFO_ENTRY );
+    delete  iAppName;
+    delete  iAppDesc;
+    delete  iMimeType;
+    delete  iWidth;
+    delete  iHeight;
+    delete  iDepth;
+    delete  iAllowedIdList;
+    delete  iProtocolId;
+    delete  iFormat;
+    delete  iDirection;
+    delete  iAppCategory;
+    delete  iAppTrustLevel;
+    delete  iContCategory;
+    delete  iContentRules;
+    delete  iContTrustLevel;
+    delete  iAudioType;
+    delete  iRscStatus;
+    delete  iSignature;
+    OstTraceFunctionExit0( CUPNPAPPFILTERINFO_CUPNPAPPFILTERINFO_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpAppFilterInfo::SetFilterInfoL
+// It compares the key with the individual elements and if it matches with none then it
+// returns invalid argument as an error.
+// @param aKey Key name
+// @param aValue Value of the key
+// @param aDisplayInfoFlag True if info type is displayInfo, false otherwise.
+//         Default is false. It is used to distinguish "trustLevel" element 
+//         of appInfo and displayInfo.
+// @param aErr Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+void CUpnpAppFilterInfo::SetFilterInfoL( const TDesC8& aKey, const TDesC8& aValue,
+                                        TTerminalModeErrorCode& aErr, TBool aDisplayInfoFlag )
+    {
+    OstTraceFunctionEntry0( CUPNPAPPFILTERINFO_SETFILTERINFOL_ENTRY );
+    aErr = ETerminalModeInvalidArgument;
+    if ( aKey.Compare(KAppName) == KErrNone )
+        {
+        delete iAppName;
+        iAppName = NULL;
+        iAppName = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KAppDesc) == KErrNone )
+        {
+        delete iAppDesc;
+        iAppDesc = NULL;
+        iAppDesc = aValue.AllocL();
+        aErr = ETerminalModeSuccess; 
+        }
+    else if ( aKey.Compare(KMimeType) == KErrNone )
+        {
+        delete iMimeType;
+        iMimeType = NULL;
+        iMimeType = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KWidth) == KErrNone )
+        {
+        delete iWidth;
+        iWidth = NULL;
+        iWidth = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KHeight) == KErrNone )
+        {
+        delete iHeight;
+        iHeight = NULL;
+        iHeight = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if ( aKey.Compare(KDepth) == KErrNone )
+        {
+        delete iDepth;
+        iDepth = NULL;
+        iDepth = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if ( aKey.Compare(KAllowedProfileIds) == KErrNone )                                     
+        {
+        delete iAllowedIdList;
+        iAllowedIdList = NULL;
+        iAllowedIdList = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KProtocolId) == KErrNone )                                     
+        {
+        delete iProtocolId;
+        iProtocolId = NULL;
+        iProtocolId = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KFormat) == KErrNone )                                     
+        {
+        delete iFormat;
+        iFormat = NULL;
+        iFormat = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KRemotingDirection) == KErrNone )                                     
+        {
+        delete iDirection;
+        iDirection = NULL;
+        iDirection = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KAppCategory) == KErrNone )
+        {
+        delete iAppCategory;
+        iAppCategory = NULL;
+        iAppCategory = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if (( aKey.Compare(KTrustLevel) == KErrNone ) && ( !aDisplayInfoFlag ))                                        
+        {
+        delete iAppTrustLevel;
+        iAppTrustLevel = NULL;
+        iAppTrustLevel = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    else if ( aKey.Compare(KContCategory) == KErrNone )
+        {
+        delete iContCategory;
+        iContCategory = NULL;
+        iContCategory = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if ( aKey.Compare(KContentRules) == KErrNone )
+        {
+        delete iContentRules;
+        iContentRules = NULL;
+        iContentRules = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if (( aKey.Compare(KTrustLevel) == KErrNone ) && ( aDisplayInfoFlag ))
+        {
+        delete iContTrustLevel;
+        iContTrustLevel = NULL;
+        iContTrustLevel = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if ( aKey.Compare(KAudioType) == KErrNone )
+        {
+        delete iAudioType;
+        iAudioType = NULL;
+        iAudioType = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if ( aKey.Compare(KRscStatus) == KErrNone )
+        {
+        delete iRscStatus;
+        iRscStatus = NULL;
+        iRscStatus = aValue.AllocL();
+        aErr = ETerminalModeSuccess;   
+        }
+    else if ( aKey.Compare(KSignature) == KErrNone )                                        
+        {
+        delete iSignature;
+        iSignature = NULL;
+        iSignature = aValue.AllocL();
+        aErr = ETerminalModeSuccess;  
+        }
+    OstTraceFunctionExit0( CUPNPAPPFILTERINFO_SETFILTERINFOL_EXIT );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpiconconversionactive.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,132 @@
+/**
+* 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: CUpnpIconConversionActive class implementation.
+*
+*/
+
+#include "upnpiconconversionactive.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpiconconversionactiveTraces.h"
+#endif
+
+// Literal 
+_LIT8(KBmpMimeType, "image/bmp");
+ 
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpIconConversionActive* CUpnpIconConversionActive::NewL( RFile& aBitmapFile )
+    {
+    OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_NEWL_ENTRY );
+    CUpnpIconConversionActive* self = new (ELeave) CUpnpIconConversionActive( ); 
+    CleanupStack::PushL(self);
+    self->ConstructL( aBitmapFile );
+    CleanupStack::Pop(self);
+    return self;  
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::CUpnpIconConversionActive
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpIconConversionActive::CUpnpIconConversionActive( )
+    :CActive(EPriorityStandard)
+    {
+    OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_ENTRY );
+    CActiveScheduler::Add(this);
+    OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpIconConversionActive::ConstructL( RFile& aBitmapFile )
+    {
+    OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_CONSTRUCTL_ENTRY );
+    // Provides access to the ICL (image conversion library) encoders.
+    iEncoder = CImageEncoder::FileNewL( aBitmapFile,KBmpMimeType()); 
+    OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::~CUpnpIconConversionActive
+// Destructor
+// ---------------------------------------------------------------------------------
+// 
+CUpnpIconConversionActive::~CUpnpIconConversionActive()
+    {   
+    OstTraceFunctionEntry0( DUP1_CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_ENTRY );
+    Cancel();
+    delete iEncoder;
+    OstTraceFunctionExit0( DUP1_CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::Convert 
+// Place where actual image conversion is invoked.
+// Its an asynchronous conversion.
+// @param aBitmap  Reference to Bitmap object
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpIconConversionActive::Convert( CFbsBitmap& aBitmap )
+    {   
+    OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_CONVERT_ENTRY );
+    TRequestStatus* status = &iStatus; 
+    // Converts image data held in CFbsBitmap object
+    iEncoder->Convert( status,aBitmap);   //Actual conversion API
+    SetActive();
+    OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_CONVERT_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::RunL
+// Event handler. Stops the active scheduler.
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpIconConversionActive::RunL()
+    {
+    OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_RUNL_ENTRY );
+    CActiveScheduler::Stop();     
+    OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_RUNL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::DoCancel
+// ---------------------------------------------------------------------------------
+//
+void CUpnpIconConversionActive::DoCancel()
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconConversionActive::FetchError
+// Returns the completion status.
+// @return Returns completion code.
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpIconConversionActive::FetchError()
+    {
+    OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_FETCHERROR_ENTRY );
+    return ( iStatus.Int() );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpiconfileservetransaction.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,142 @@
+/**
+* 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: CUpnpIconFileServeTransaction implementation.
+*
+*/
+
+
+#include "upnpiconfileservetransaction.h"
+#include <upnperrors.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpiconfileservetransactionTraces.h"
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconFileServeTransaction::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpIconFileServeTransaction* CUpnpIconFileServeTransaction::NewL( const TDesC& aOutFilePath,
+                                                                       RFs& aIconFileSession )
+       
+    {
+    OstTraceFunctionEntry0( CUPNPICONFILESERVETRANSACTION_NEWL_ENTRY );
+    CUpnpIconFileServeTransaction* self = 
+                     new (ELeave) CUpnpIconFileServeTransaction( aIconFileSession );
+    CleanupStack::PushL( self );
+    self->ConstructL( aOutFilePath );
+    CleanupStack::Pop( self );
+    OstTraceFunctionExit0( CUPNPICONFILESERVETRANSACTION_NEWL_EXIT );
+    return self;
+    }    
+    
+// ---------------------------------------------------------------------------------
+// CUpnpIconFileServeTransaction::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpIconFileServeTransaction::ConstructL( const TDesC& aOutFilePath )
+    {
+    OstTraceFunctionEntry0( CUPNPICONFILESERVETRANSACTION_CONSTRUCTL_ENTRY );
+    iOutFilePath.CreateL( aOutFilePath );
+    OstTraceFunctionExit0( CUPNPICONFILESERVETRANSACTION_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconFileServeTransaction::CUpnpIconFileServeTransaction
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpIconFileServeTransaction::CUpnpIconFileServeTransaction( RFs& aIconFileSession )
+    :iIconFileSession( aIconFileSession )
+    { 
+    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconFileServeTransaction::~CUpnpIconFileServeTransaction
+// Default Destructor
+// ---------------------------------------------------------------------------------
+//    
+CUpnpIconFileServeTransaction::~CUpnpIconFileServeTransaction()
+    {
+    OstTraceFunctionEntry0( CUPNPICONFILESERVETRANSACTION_CUPNPICONFILESERVETRANSACTION_ENTRY );
+    iOutFilePath.Close();
+    OstTraceFunctionExit0( CUPNPICONFILESERVETRANSACTION_CUPNPICONFILESERVETRANSACTION_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconFileServeTransaction::OnCallbackL
+// Handler for transaction event.
+// Method is invoked when a particular event arrives.
+// In case of leave,it traps the error and returns the http error code.
+// @param aEvent Server event
+// ---------------------------------------------------------------------------------
+//    
+void CUpnpIconFileServeTransaction::OnCallbackL( TUpnpHttpServerEvent aEvent )
+    {
+    OstTraceFunctionEntry0( CUPNPICONFILESERVETRANSACTION_ONCALLBACKL_ENTRY );
+    TRAPD( err, DoCallbackL( aEvent ) );
+    if ( err != KErrNone )
+        {
+        SetHttpCode( err );
+        }
+    OstTraceFunctionExit0( CUPNPICONFILESERVETRANSACTION_ONCALLBACKL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpIconFileServeTransaction::DoCallbackL
+// Method is used to set the data source file and respective http error codes.
+// @param aEvent Server event
+// ---------------------------------------------------------------------------------
+//  
+void CUpnpIconFileServeTransaction::DoCallbackL( TUpnpHttpServerEvent aEvent )
+    {
+    OstTraceFunctionEntry0( CUPNPICONFILESERVETRANSACTION_DOCALLBACKL_ENTRY );
+    switch ( aEvent )
+        {
+        case EOnRequestStart:
+            { 
+            RFile file;
+            if ( file.Open( iIconFileSession,iOutFilePath,EFileShareReadersOnly | EFileRead ) == KErrNone ) 
+                {
+                CleanupClosePushL(file);
+                // Sets the file which have to be served in response to http request
+                SetDataSourceL(  file ); 
+                CleanupStack::Pop(&file);
+                }
+            else
+                {
+                // if the error occurs set the error code in http response
+                SetHttpCode( -EHttpNotFound );
+                }                                  
+            }break;
+        case EOnComplete:
+            break;  
+        case EOnResponseStart:
+            {
+            SetHttpCode( KErrNone );
+            } break;          
+        default:
+            break;
+        }            
+    OstTraceFunctionExit0( CUPNPICONFILESERVETRANSACTION_DOCALLBACKL_EXIT );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpremotableapp.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,177 @@
+/**
+* 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: CUpnpRemotableApp class implementation.
+*
+*/
+
+#include "upnpremotableapp.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpremotableappTraces.h"
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::NewL
+// Two-phased constructor.
+// @param aAppId App ID of the remotable app
+// @param aAppName Name of the remotable app
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C CUpnpRemotableApp* CUpnpRemotableApp::NewL( TUint aAppId ,const TDesC8& aAppName )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_NEWL_ENTRY );
+    CUpnpRemotableApp* self = new (ELeave) CUpnpRemotableApp(aAppId);    
+    CleanupStack::PushL(self);
+    self->ConstructL( aAppName );  
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::CUpnpRemotableApp
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableApp::CUpnpRemotableApp( TUint aAppId ):iAppId(aAppId)
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpRemotableApp::ConstructL( const TDesC8& aAppname )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_CONSTRUCTL_ENTRY );
+    iAppName.CreateL(aAppname);
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::~CUpnpRemotableApp
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableApp::~CUpnpRemotableApp()
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_CUPNPREMOTABLEAPP_ENTRY );
+    iTmInfoElementList.ResetAndDestroy();
+    iTmInfoElementList.Close();
+    iProfileIdList.Close();
+    iIconList.ResetAndDestroy();
+    iIconList.Close();
+    iAppName.Close();
+    iAppDescription.Close();
+    iResourceStatus.Close();
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_CUPNPREMOTABLEAPP_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::AddIconL
+// Method is used to add an icon element to the application.
+// @param aIcon Pointer to TerminalMode icon object
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpRemotableApp::AddIconL(CUpnpTerminalModeIcon* aIcon)
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_ADDICONL_ENTRY );
+    iIconList.AppendL(aIcon);
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_ADDICONL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::SetAppDescriptionL
+// Method is used to add the description of the application
+// @param aDescription Description of the aapplication
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpRemotableApp::SetAppDescriptionL( const TDesC8& aDescription )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_SETAPPDESCRIPTIONL_ENTRY );
+    iAppDescription.Close();
+    iAppDescription.CreateL(aDescription);
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_SETAPPDESCRIPTIONL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::SetAllowedProfileIdListL
+// Method is used to set the list of allowed profile IDs for the application.
+// @param aProfileIdList Reference to the list of allowed profile IDs.
+//                       A copy of the list is maintained.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpRemotableApp::SetAllowedProfileIdListL( const RArray<TUint>& aProfileIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_SETALLOWEDPROFILEIDLISTL_ENTRY );
+    iProfileIdList.Close();
+    /**
+     * Create a copy of the profile ID list.
+     * Only distinct and unique profile IDs are copied into the array.
+     */
+    for ( TInt i(0); i < aProfileIdList.Count(); i++ )
+        {
+        OstTrace1( TRACE_NORMAL, CUPNPREMOTABLEAPP_SETALLOWEDPROFILEIDLISTL, "CUpnpRemotableApp::SetAllowedProfileIdListL;aProfileIdList[i]=%d", aProfileIdList[i] );
+        if ( iProfileIdList.Find(aProfileIdList[i]) == KErrNotFound )
+            {
+            iProfileIdList.AppendL(aProfileIdList[i]);
+            }
+        }
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_SETALLOWEDPROFILEIDLISTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::CreateTmInfoElementL
+// Method is used to create a terminal mode info for the application and 
+// it gets appended to the terminal mode list.
+// @param aTerminalModeInfoType Terminal Mode Info Type
+// @return Returns the reference to the CUpnpTerminalModeInfo object
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C CUpnpTmInfoElement& CUpnpRemotableApp::CreateTmInfoElementL(
+                       CUpnpTmInfoElement::TTerminalModeInfoType aTerminalModeInfoType )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_CREATETERMINALMODEINFOL_ENTRY );
+    CUpnpTmInfoElement* tmInfoElement = CUpnpTmInfoElement::NewL(aTerminalModeInfoType);
+    CleanupStack::PushL(tmInfoElement);
+    iTmInfoElementList.AppendL(tmInfoElement);
+    CleanupStack::Pop(tmInfoElement);
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_CREATETERMINALMODEINFOL_EXIT );
+    return *tmInfoElement;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::SetResourceStatusL
+// Method is used to define the current status of the resource.
+// @param aResourceStatus Status of the resource
+//   “free” – Resource is free. Can be used by the Terminal Mode client. (default)
+//   “busy” – Resource already used. Resource assignment can be overridden by
+//            a client’s invocation LaunchApplication action.
+//   “NA” – Resource already used. Resource assignment cannot be overridden by a 
+//          LaunchApplication action invoked by a client.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpRemotableApp::SetResourceStatusL( const TDesC8& aResourceStatus )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPP_SETRESOURCESTATUSL_ENTRY );
+    iResourceStatus.Close();
+    iResourceStatus.CreateL(aResourceStatus); 
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPP_SETRESOURCESTATUSL_EXIT );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpremotableappstore.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,145 @@
+/**
+* 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: 
+*
+*/
+
+
+// INCLUDE FILES
+#include "upnpremotableappstore.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpremotableappstoreTraces.h"
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableAppStore* CUpnpRemotableAppStore::NewL()
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPPSTORE_NEWL_ENTRY );
+    return ( new (ELeave) CUpnpRemotableAppStore()); 
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::CUpnpRemotableAppStore
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableAppStore::CUpnpRemotableAppStore( )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::~CUpnpRemotableAppStore
+// Destructor 
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableAppStore::~CUpnpRemotableAppStore()
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPPSTORE_CUPNPREMOTABLEAPPSTORE_ENTRY );
+    iRemotableAppArray.ResetAndDestroy();
+    iRemotableAppArray.Close();
+    iAppIdArray.Close();
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPPSTORE_CUPNPREMOTABLEAPPSTORE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::AppendRemotableAppL
+// Method is used to create a list of all the registered apps
+// @param aApp Pointer to CUpnpRemotableApp object
+// ---------------------------------------------------------------------------------
+//
+void CUpnpRemotableAppStore::AddRemotableAppL( CUpnpRemotableApp* aApp )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPPSTORE_ADDREMOTABLEAPPL_ENTRY );
+    TInt appId = aApp->AppId();
+    if ( iAppIdArray.Find( appId ) == KErrNotFound )
+        {
+        // Register all distinct apps
+        OstTrace1( TRACE_FLOW, CUPNPREMOTABLEAPPSTORE_ADDREMOTABLEAPPL, "CUpnpRemotableAppStore::AddRemotableAppL;appId=%d", appId );    
+        iRemotableAppArray.AppendL(aApp);
+        iAppIdArray.AppendL( appId );
+        }
+    else
+        {
+        // Delete the duplicate remotable app object
+        delete aApp;
+        aApp = NULL;
+        }
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPPSTORE_ADDREMOTABLEAPPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::RemoveRemotableApp
+// Method is used to remove the app frpm the list of already registered apps
+// @param aAppId App to be removed
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpRemotableAppStore::RemoveRemotableApp( TUint aAppId )
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPPSTORE_REMOVEREMOTABLEAPP_ENTRY );
+    TInt ret(KErrNotFound);
+    TInt appIndex = iAppIdArray.Find( aAppId );
+    if ( appIndex != KErrNotFound )
+        {
+        // If appID is matched then delete the Remotable App object and remove 
+        // the object pointer from the array
+        iAppIdArray.Remove(appIndex);
+        delete iRemotableAppArray[appIndex];
+        iRemotableAppArray[appIndex] = NULL;
+        iRemotableAppArray.Remove(appIndex);
+        ret = KErrNone;
+        }
+    OstTrace1( TRACE_NORMAL, CUPNPREMOTABLEAPPSTORE_REMOVEREMOTABLEAPP, "CUpnpRemotableAppStore::RemoveRemotableApp;ret=%d", ret );  
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPPSTORE_REMOVEREMOTABLEAPP_EXIT );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::FetchRemotableApp
+// Method is used to fetch the list of registered apps
+// @param aAppId App ID of the application whose access is needed
+// @return Returns reference to CUpnpRemotableApp object
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableApp& CUpnpRemotableAppStore::FetchRemotableApp( TInt aAppIndex )const
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPPSTORE_FETCHREMOTABLEAPP_ENTRY );
+    ASSERT( aAppIndex >=0 );
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPPSTORE_FETCHREMOTABLEAPP_EXIT );
+    return *iRemotableAppArray[aAppIndex];
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableAppStore::AppIdArray
+// Method is used to fetch the list of appIDs of registered apps
+// @return Returns reference to an array of TInt objects
+// ---------------------------------------------------------------------------------
+//
+const RArray<TUint>& CUpnpRemotableAppStore::AppIdArray()const 
+    {
+    OstTraceFunctionEntry0( CUPNPREMOTABLEAPPSTORE_APPIDARRAY_ENTRY );
+    OstTraceFunctionExit0( CUPNPREMOTABLEAPPSTORE_APPIDARRAY_EXIT );
+    return iAppIdArray;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpsvgimageconverter.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,363 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpSvgImageConverter class implementation.
+*
+*/
+
+#include "upnpsvgimageconverter.h"
+#include "upnptmserverimpl.h"
+#include <f32file.h> 
+#include "upnpiconconversionactive.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpsvgimageconverterTraces.h"
+#endif
+
+// Literals
+_LIT(KLatin,               "LatinPlain12");
+_LIT(KConvertedIconPath,   "public\\TmServerDevice1\\");
+_LIT(KCross,               "x");
+_LIT(KDotBmp,              ".bmp");
+_LIT(KThreadName,          "ImageConverterThread");
+_LIT(KSemaphoreName,       "ImageConverterSemaphore");
+
+// Constant
+const TUint KDot           = '.';
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::NewL
+// Two-phased constructor.
+// @param aIconWidth   Desired width of the serving icon.
+// @param aIconHeight  Desired height of the serving icon.
+// ---------------------------------------------------------------------------------
+//
+CUpnpSvgImageConverter* CUpnpSvgImageConverter::NewL( TInt aIconWidth, TInt aIconHeight )
+    {
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_NEWL_ENTRY );
+    OstTraceExt2( TRACE_NORMAL, CUPNPSVGIMAGECONVERTER_NEWL, "CUpnpSvgImageConverter::NewL;aIconWidth=%d;aIconHeight=%d", aIconWidth, aIconHeight );
+    CUpnpSvgImageConverter* self = new (ELeave) CUpnpSvgImageConverter( );
+    CleanupStack::PushL(self);
+    self->ConstructL( aIconWidth,aIconHeight );
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_NEWL_EXIT );
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::CUpnpSvgImageConverter
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpSvgImageConverter::CUpnpSvgImageConverter( )                                      
+    {
+
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpSvgImageConverter::ConstructL(  TInt aIconWidth, TInt aIconHeight )
+    {
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_CONSTRUCTL_ENTRY );
+    //Geometric rectangle.
+    TRect lMainRect( 0,0,aIconWidth,aIconHeight );
+    /**
+     * Specifies the font specification to use for text drawing.
+     * Here "LatinPlain12" of height "10" is used.
+     */ 
+    TFontSpec lFontSpec( KLatin,UpnpString::KMaxTUintLength );
+    // A bitmap managed by the font and bitmap server.
+    User::LeaveIfError(iFbsSession.Connect());
+    iBitmap = new ( ELeave ) CFbsBitmap();
+    iMask = new ( ELeave ) CFbsBitmap();
+    //Creates bitmap file of the desired dimensions with desired display mode(64,000 colour)
+    User::LeaveIfError( iBitmap->Create( TSize( lMainRect.Width(),
+                        lMainRect.Height() ),EColor64K ) );
+    User::LeaveIfError( iMask->Create( TSize( lMainRect.Width(),
+                            lMainRect.Height() ),EGray256 ) );  // 256 grayscales display mode as alpha values
+    /**
+     * Create a new Svg Engine interface.
+     * @param iBitmap  bitmap to draw resulting svg image.
+     * @param aReqObserver(NULL) interface for callbacks to retrieve info
+     *                          only client can provide, such as opening files.
+     * @param lFontSpecFont spec to use for text drawing.
+     */
+    iSvgModule = CSvgEngineInterfaceImpl::NewL( iBitmap,NULL,lFontSpec );
+    User::LeaveIfError( iFileSession.Connect() );  
+    TBuf<UpnpString::KMaxFilenameLength> privatePath;  
+    User::LeaveIfError( iFileSession.PrivatePath(privatePath) );
+
+    privatePath.Append(KConvertedIconPath());
+    privatePath.AppendNum( aIconWidth );
+    privatePath.Append( KCross);
+    privatePath.AppendNum( aIconHeight );
+    privatePath.Append( UpnpString::KDoubleBackSlash16() );
+    TInt err = iFileSession.MkDir(privatePath);
+    if( ( err != KErrNone ) && ( err != KErrAlreadyExists ) )
+        {
+        // Leaves if fails to create a directory
+        User::Leave(err);
+        }
+    iBitMapFilePath.CreateL( UpnpString::KMaxFilenameLength );
+    iBitMapFilePath.Append( privatePath );
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::~CUpnpSvgImageConverter
+// Destructor
+// ---------------------------------------------------------------------------------
+// 
+CUpnpSvgImageConverter::~CUpnpSvgImageConverter()
+    {  
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_CUPNPSVGIMAGECONVERTER_ENTRY );
+    iBitMapFilePath.Close();
+    delete iMask;
+    delete iBitmap;
+    delete iSvgModule;        
+    iFbsSession.Disconnect();
+    iFileSession.Close();
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_CUPNPSVGIMAGECONVERTER_EXIT );
+    }
+
+// -----------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::ConvertToBitmapL
+// Method invokes svg to bitmap conversion.
+// It takes svg file as an input and returns converted icon file( bmp ).
+// Also prepares DOM for given SVG file.
+// @param aSvgFile Input svg filepath
+// @param aBitmapFile[out] Bitmap filepath ( converted file ).
+// -----------------------------------------------------------------------------------
+void CUpnpSvgImageConverter::ConvertToBitmapL( const TDesC& aSvgFile, RBuf& aBitmapFile )
+    { 
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_CONVERTTOBITMAPL_ENTRY );
+    /**
+     * Extracts the filename( without filename extension ) from the input svg filepath and 
+     * uses the same filename to create bitmap file ( eg: abc.bmp )
+     */ 
+    TPtrC iconFileNameWithExtension = aSvgFile.Mid((aSvgFile.LocateReverse(KDirectorySeparator))+1);
+    iBitMapFilePath.Append( iconFileNameWithExtension.Left(iconFileNameWithExtension.LocateReverse(KDot)) );
+    iBitMapFilePath.Append( KDotBmp );
+    RFile iconFile;
+    TInt err = iconFile.Create(iFileSession,iBitMapFilePath,EFileRead|EFileWrite|EFileShareAny);
+    OstTrace1( TRACE_NORMAL, CUPNPSVGIMAGECONVERTER_CONVERTTOBITMAPL, "CUpnpSvgImageConverter::ConvertToBitmapL;err=%d", err );
+    iconFile.Close();
+    aBitmapFile.Close();
+    if ( err == KErrAlreadyExists )
+        {
+        //If the converted file pre-exists, just return the existing filepath.
+        aBitmapFile.CreateL(iBitMapFilePath);
+        }
+    else if ( err == KErrNone )
+        {
+        TInt domHandle;
+        /**
+         * Parses and Prepares DOM for given SVG file.
+         * @param aSvgFile the name of the file  to be parsed
+         * @param domHandle  Handle to the created DOM.
+         * @return lsvgerr Error object specifying  the error occured during operation
+         */
+        MSvgError* lsvgerr = iSvgModule->PrepareDom( aSvgFile,domHandle ,NULL );
+        if ( (! lsvgerr ) || ( lsvgerr && lsvgerr->HasError() &&!lsvgerr->IsWarning() ) )
+            {    
+            User::Leave( KErrCancel );
+            }   
+        /**
+         *Initialization of the engine 
+         *@param domHandle Handle to DOM Tree.
+         *@param iBitmap Buffer for drawing the DOM Tree.
+         *@param iMask  Buffer for mask (alpha values) of framebuffer result
+         *@return lsvgerr Error object specifying the error occured.
+         */
+        lsvgerr = iSvgModule->UseDom( domHandle ,iBitmap,iMask );
+        if ( (! lsvgerr ) || ( lsvgerr && lsvgerr->HasError() &&!lsvgerr->IsWarning() ) )
+            {      
+            User::Leave( KErrCancel );
+            }
+        /**
+         * Request the SVG Engine to begin an animation. 
+         */
+        iSvgModule->Start( lsvgerr );
+        if ( (! lsvgerr ) || ( lsvgerr && lsvgerr->HasError() &&!lsvgerr->IsWarning() ) )
+            {      
+            User::Leave( KErrCancel );
+            }
+        /**
+          * Deletes the DOM tree associated with the Handle.
+          */
+        lsvgerr = iSvgModule->DeleteDom( domHandle ) ;
+        if ( (! lsvgerr ) || ( lsvgerr && lsvgerr->HasError() &&!lsvgerr->IsWarning() ) )
+            {      
+            User::Leave( KErrCancel );
+            }
+        /** 
+         * Creates and starts a new thread to handle asynchronous icon conversion.
+         * A new or separate thread is needed for this purpose since the conversion happens 
+         * in the same thread as of that of the one who invokes.
+         */
+        StartThreadL();
+        // Sets the converted filepath
+        aBitmapFile.CreateL(iBitMapFilePath);
+        }
+    else
+        {
+        User::Leave(err);
+        }
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_CONVERTTOBITMAPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::StartThreadL
+// Creates a new thread where actual conversion occurs.
+// Also creates a sempahore and waits on it.
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpSvgImageConverter::StartThreadL( )
+    {   
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_STARTTHREADL_ENTRY );
+    // Creates and opens a semaphore
+    RSemaphore semaphore;
+    CleanupClosePushL(semaphore);
+    TInt error = semaphore.CreateGlobal( KSemaphoreName, KErrNone );
+    if ( error == KErrAlreadyExists )
+       {
+       User::LeaveIfError(semaphore.OpenGlobal( KSemaphoreName ));
+       }
+    else
+       {
+       User::LeaveIfError(error);
+       }   
+    // Creates a new thread which will be in suspended state after creation
+    RThread thread;
+    CleanupClosePushL(thread);
+    User::LeaveIfError( thread.Create( KThreadName,
+                                       ImageConverter,
+                                       KDefaultStackSize,
+                                       NULL,
+                                       this,
+                                       EOwnerProcess));
+    thread.SetPriority(EPriorityRealTime);
+    //Resumes the newly created thread
+    thread.Resume();
+    semaphore.Wait(); 
+    CleanupStack::PopAndDestroy(2,&semaphore);
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_STARTTHREADL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::Filepath
+// Method to return the path of the icon file which needs to be converted.
+// @return Returns reference to Bitmap file path.
+// ---------------------------------------------------------------------------------
+// 
+const TDesC& CUpnpSvgImageConverter::Filepath( )const
+    {
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_FILEPATH_ENTRY );
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_FILEPATH_EXIT );
+    return iBitMapFilePath; 
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::BitmapObject
+// Method to return the bitmap object.
+// @return Returns reference to Bitmap object.
+// ---------------------------------------------------------------------------------
+// 
+CFbsBitmap& CUpnpSvgImageConverter::BitmapObject()const 
+    {
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_BITMAPOBJECT_ENTRY );
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_BITMAPOBJECT_EXIT );
+    return *iBitmap;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::ImageConverter
+// Static method serving as thread's main function
+// @param aParam  Pointer to any type object.
+// @return Returns error code
+// ---------------------------------------------------------------------------------
+// 
+TInt CUpnpSvgImageConverter::ImageConverter( TAny* aParam )
+    {
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_IMAGECONVERTER_ENTRY );
+    TInt err( KErrNone );
+    CUpnpSvgImageConverter* svgConverter = static_cast <CUpnpSvgImageConverter*>( aParam );
+    // Create cleanupstack
+    CTrapCleanup* cleanupStack = CTrapCleanup::New();
+    if ( !cleanupStack )
+        {
+        err = KErrNoMemory;
+        }
+    else
+        {
+        TRAP( err, ImageConverterL(*svgConverter) );
+        }
+    // Create a matching semaphore for signalling the waiting semaphore
+    RSemaphore semaphoreStop;
+    semaphoreStop.OpenGlobal(KSemaphoreName);
+    semaphoreStop.Signal();
+    semaphoreStop.Close();
+    
+    delete cleanupStack;
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_IMAGECONVERTER_EXIT );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpSvgImageConverter::ImageConverterL
+// Called from thread's main function.
+// Contains the code which can leave.
+// @param aSvgConverter  Reference to class object.
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpSvgImageConverter::ImageConverterL( CUpnpSvgImageConverter& aSvgConverter )
+    {
+    OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_IMAGECONVERTERL_ENTRY );
+    /** 
+     * Add support for active objects
+     * Create and install active scheduler
+     */
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL(scheduler);
+    CActiveScheduler::Install( scheduler );
+    // Opens the bitmap file and supplies it to the active object
+    RFs fs;
+    CleanupClosePushL( fs );
+    User::LeaveIfError(fs.Connect());
+    RFile bitmapFile;
+    CleanupClosePushL( bitmapFile );
+    User::LeaveIfError( bitmapFile.Open( fs, aSvgConverter.Filepath(), EFileRead|EFileWrite|EFileShareAny ));
+  
+    // Create an active object that is executed in this thread
+    CUpnpIconConversionActive* active = CUpnpIconConversionActive::NewL( bitmapFile );
+    CleanupStack::PushL(active); 
+    // Invoke the request to the active object
+    active->Convert( aSvgConverter.BitmapObject() );
+    // Thread execution starts
+    CActiveScheduler::Start();
+    User::LeaveIfError( active->FetchError() );  // Leaves if the status returned is not KErrNone
+    
+    /**
+     * Thread execution ends (waiting for CActiveScheduler::Stop())
+     * Cleanup the active object and scheduler
+     */ 
+    CleanupStack::PopAndDestroy(UpnpString::KDoubleLineFeedLength,scheduler);
+    OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_IMAGECONVERTERL_EXIT );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnpterminalmodeicon.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,92 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTerminalModeIcon class implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "upnpterminalmodeicon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnpterminalmodeiconTraces.h"
+#endif
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::NewL
+// Two-phased constructor.
+// @param aPath     icon path
+// @param aWidth    icon width
+// @param aHeight   icon height
+// @param aDepth    icon depth
+// @param aMimeType icon mime type
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C CUpnpTerminalModeIcon* CUpnpTerminalModeIcon::NewL( const TDesC16& aPath, const TInt aWidth, 
+                                     const TInt aHeight, const TInt aDepth, const TDesC8& aMimeType )
+    {
+    OstTraceFunctionEntry0( CUPNPTERMINALMODEICON_NEWL_ENTRY );
+    CUpnpTerminalModeIcon* self = new (ELeave) CUpnpTerminalModeIcon( aWidth,aHeight,aDepth );
+    CleanupStack::PushL( self );
+    self->ConstructL( aPath,aMimeType );
+    CleanupStack::Pop( self );
+    OstTraceFunctionExit0( CUPNPTERMINALMODEICON_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::CUpnpTerminalModeIcon
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// @param aWidth    icon width
+// @param aHeight   icon height
+// @param aDepth    icon depth
+// ---------------------------------------------------------------------------------
+//
+CUpnpTerminalModeIcon::CUpnpTerminalModeIcon( const TInt aWidth,const TInt aHeight,
+    const TInt aDepth ):iIconWidth(aWidth),iIconHeight(aHeight),iIconDepth(aDepth)
+    {
+
+    }
+
+// -------------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::ConstructL
+// Symbian 2nd phase constructor can leave.
+// @param aPath     icon path
+// @param aMimeType icon mime type
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTerminalModeIcon::ConstructL( const TDesC16& aPath,const TDesC8& aMimeType )
+    {
+    OstTraceFunctionEntry0( CUPNPTERMINALMODEICON_CONSTRUCTL_ENTRY );
+    iFilename = aPath.AllocL();
+    iIconMimeType = aMimeType.AllocL();
+    OstTraceFunctionExit0( CUPNPTERMINALMODEICON_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::~CUpnpTerminalModeIcon
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTerminalModeIcon::~CUpnpTerminalModeIcon()
+    {
+    OstTraceFunctionEntry0( CUPNPTERMINALMODEICON_CUPNPTERMINALMODEICON_ENTRY );
+    delete iFilename;
+    delete iIconMimeType;
+    OstTraceFunctionExit0( CUPNPTERMINALMODEICON_CUPNPTERMINALMODEICON_EXIT );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmappserverservice.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,400 @@
+/**
+* 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: CUpnpTmAppServerService class implementation.
+*
+*/
+
+
+// System includes
+#include <upnpdevice.h>
+#include <upnpservice.h>
+
+//User includes
+#include "upnptmappserverservice.h"
+#include "upnptmserverdevice.h"
+#include "upnptmserverimpl.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmappserverserviceTraces.h"
+#endif
+
+
+//Defines different action names ,their arguments and their related state variables
+_LIT8(KGetApplicationList,             "GetApplicationList");
+_LIT8(KLaunchApp,                      "LaunchApplication");
+_LIT8(KTerminateApp,                   "TerminateApplication");
+_LIT8(KGetAppStatus,                   "GetApplicationStatus");
+_LIT8(KAppFilter,                      "AppListingFilter");
+_LIT8(KProfileId,                      "ProfileID");
+_LIT8(KAppListing,                     "AppListing");
+_LIT8(KAppId ,                         "AppID");
+_LIT8(KAppStatus,                      "AppStatus");
+_LIT8(KAppLaunchUri,                   "AppURI");
+_LIT8(KAppTerminateResult,             "TerminationResult");
+_LIT8(KArgTypeAppList,                 "A_ARG_TYPE_AppList");
+_LIT8(KArgTypeAppStatus,               "A_ARG_TYPE_AppStatus");
+_LIT8(KArgTypeAppStatusUpdate,         "AppStatusUpdate");
+_LIT8(KArgTypeAppListUpdate,           "AppListUpdate");
+_LIT8(KStatusTrue,                     "True");
+_LIT8(KStatusFalse,                    "False");
+
+
+// ================= MEMBER FUNCTIONS ==============================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::CUpnpTmAppServerService
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmAppServerService::CUpnpTmAppServerService( CUpnpDevice& aUpnpDevice,CUpnpTmServerImpl& aTmServerImpl ):
+    CUpnpServiceImplementation(aUpnpDevice),iUpnpDevice(aUpnpDevice), iTmServerImpl(aTmServerImpl)
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::~CUpnpTmAppServerService
+// C++ default destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmAppServerService::~CUpnpTmAppServerService()
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_CUPNPTMAPPSERVERSERVICE_ENTRY );
+    if ( iHttpServerSession )
+        {
+        iHttpServerSession->Stop();
+        }
+    delete iHttpServerSession;
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_CUPNPTMAPPSERVERSERVICE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::ConstructL
+// Two-phased constructor.
+// Initialize variables, set parent service and create XML reader.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::ConstructL( const TDesC& aDescriptionPath )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_CONSTRUCTL_ENTRY );
+    _LIT8( KServiceType, "TmApplicationServer:1" );
+    BaseConstructL( aDescriptionPath, KServiceType);
+
+    SetStateVariableL( KArgTypeAppList, KEmptyString, EFalse );
+    SetStateVariableL( KArgTypeAppStatus, KEmptyString, EFalse );
+    SetStateVariableL( KArgTypeAppStatusUpdate, KEmptyString, EFalse );
+    SetStateVariableL( KArgTypeAppListUpdate, KEmptyString, EFalse );
+    ConstructHttpL( );
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::ConstructHttpL
+// Method is used to start the HTTP Server
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::ConstructHttpL( )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_CONSTRUCTHTTPL_ENTRY );
+    iHttpServerSession = CUpnpHttpServerSession::NewL( CUpnpSettings::GetIapL(),*this );
+    iHttpServerSession->DefaultRuntime().SetCreator( *this );
+    iHttpServerSession->StartL();
+    iTmServerImpl.GenerateUrlComponents(*iHttpServerSession);
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_CONSTRUCTHTTPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmAppServerService* CUpnpTmAppServerService::NewL(CUpnpDevice& aUpnpDevice, const TDesC& aDescriptionPath, 
+                                                                               CUpnpTmServerImpl& aTmServerImp )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_NEWL_ENTRY );
+    CUpnpTmAppServerService* appServerService = new (ELeave) CUpnpTmAppServerService(aUpnpDevice, aTmServerImp);
+    CleanupStack::PushL( appServerService );
+    appServerService->ConstructL( aDescriptionPath );
+    CleanupStack::Pop( appServerService );
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_NEWL_EXIT );
+    return appServerService;
+    }
+
+// ----------------------------------------------------------------------------------------------
+// CUpnpTmAppServerService::ActionReceivedLD
+// @param aAction action received from the client
+// ----------------------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::ActionReceivedLD( CUpnpAction* aAction )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_ACTIONRECEIVEDLD_ENTRY );
+    if ( !aAction )
+        {
+        User::Leave( KErrNotFound );
+        }
+    CleanupStack::PushL( aAction );
+    TUpnpErrorCode eCode = EHttpOk;
+    
+    // Get the name, saves calls in the if-else statements
+    TPtrC8 name( aAction->Name() );
+    // Verify the action and do the operation(s)
+    if ( name.Compare( KGetApplicationList ) == 0 )
+        {
+        eCode = GetAppListActionL( aAction );
+        }
+    else if ( name.Compare( KLaunchApp ) == 0 )
+        {
+        eCode = LaunchAppActionL( aAction );
+        }
+    else if ( name.Compare( KTerminateApp ) == 0 )
+        {
+        eCode = TerminateAppActionL ( aAction );
+        }
+    else if ( name.Compare( KGetAppStatus) == 0 )
+        {
+        eCode = GetAppStatusActionL( aAction );
+        }
+    else
+        {
+        eCode = EInvalidAction;
+        }
+    SendL( aAction, eCode );
+    CleanupStack::PopAndDestroy( aAction );
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_ACTIONRECEIVEDLD_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::GetAppListActionL
+// @param aAction pointer to upnp action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmAppServerService::GetAppListActionL( CUpnpAction* aAction )
+   {
+   OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_GETAPPLISTACTIONL_ENTRY );
+   // Fetch the value for app listing filter argument
+   const TDesC8& filter = aAction->ArgumentValue(KAppFilter);
+   // Validate the AppListing filter string
+   // AppListingFilter input argument can contain wither wildcard(*) or
+   // a well formatted string
+   if ( ( filter.Compare(KWildCard ) != KErrNone ) && ( filter.Find(Keq) == KErrNotFound ))
+       {
+       // The filter string is having neither wildcard(*) nor a proper string( =" is missing )
+       OstTrace0( TRACE_ERROR, DUP2_CUPNPTMAPPSERVERSERVICE_GETAPPLISTACTIONL, "CUpnpTmAppServerService::GetAppListActionL" );   
+       return EInvalidArgs;  // invalid AppListingFilter argument
+       }
+   
+   // Fetch the value for profile ID argument
+   TUint profileIdInt;
+   ConvertDescriptorToInt( aAction->ArgumentValue(KProfileId), profileIdInt );
+   OstTrace1( TRACE_NORMAL, CUPNPTMAPPSERVERSERVICE_GETAPPLISTACTIONL, "CUpnpTmAppServerService::GetAppListActionL;profileIdInt=%u", profileIdInt );
+   
+   TTerminalModeErrorCode ret;
+   const TDesC8& appList = iTmServerImpl.GetApplicationListL( filter,profileIdInt,ret );
+   if ( ret != ETerminalModeSuccess )
+       {
+       OstTrace1( TRACE_ERROR, DUP1_CUPNPTMAPPSERVERSERVICE_GETAPPLISTACTIONL, "CUpnpTmAppServerService::GetAppListActionL;ret=%d", ret );
+       return TUpnpErrorCode( ret );       
+       }
+   aAction->SetArgumentL( KAppListing, appList ); 
+   OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_GETAPPLISTACTIONL_EXIT );
+   return EHttpOk;
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::LaunchAppActionL
+// @param aAction pointer to upnp action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmAppServerService::LaunchAppActionL( CUpnpAction* aAction )
+   {
+   OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL_ENTRY );
+   TUint appIdInt;  
+   TUint profileIdInt;
+   // Validates the input parameters
+   if ( ( ConvertDescriptorToInt( aAction->ArgumentValue(KAppId), appIdInt ) != KErrNone )
+       || ( ConvertDescriptorToInt( aAction->ArgumentValue(KProfileId), profileIdInt ) != KErrNone ))
+        {
+        OstTraceExt2( TRACE_ERROR, CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL, "CUpnpTmAppServerService::LaunchAppActionL;appIdInt=%u;profileIdInt=%u", appIdInt, profileIdInt );
+        return EInvalidArgs;   // either invalid app ID or invalid profile ID  
+        }
+
+   RBuf8 launchUrl;
+   TTerminalModeErrorCode ret = iTmServerImpl.LaunchApp( appIdInt,profileIdInt,launchUrl );
+   
+   if ( ret != ETerminalModeSuccess )
+       {
+       // Error is returned
+       launchUrl.Close();
+       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL, "CUpnpTmAppServerService::LaunchAppActionL" );   
+       return TUpnpErrorCode( ret );
+       }
+   CleanupClosePushL(launchUrl);
+   aAction->SetArgumentL( KAppLaunchUri , launchUrl );
+   
+   CleanupStack::PopAndDestroy(&launchUrl);
+   OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL_EXIT );
+   return EHttpOk;  
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::TerminateAppActionL
+// @param aAction pointer to upnp action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmAppServerService::TerminateAppActionL( CUpnpAction* aAction )
+   { 
+   OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_TERMINATEAPPACTIONL_ENTRY );
+   // Validates the input parameters
+   TUint appIdInt;   
+   TUint profileIdInt;
+   if ( ( ConvertDescriptorToInt( aAction->ArgumentValue(KAppId), appIdInt ) != KErrNone )
+       || ( ConvertDescriptorToInt( aAction->ArgumentValue(KProfileId), profileIdInt ) != KErrNone ))
+        {
+        OstTraceExt2( TRACE_ERROR, CUPNPTMAPPSERVERSERVICE_TERMINATEAPPACTIONL, "CUpnpTmAppServerService::TerminateAppActionL;appIdInt=%u;profileIdInt=%u", appIdInt, profileIdInt );
+        return EInvalidArgs;   // either invalid app ID or invalid profile ID  
+        }
+   
+   TTerminalModeErrorCode ret = iTmServerImpl.TerminateApp( appIdInt,profileIdInt );
+   if ( ret != ETerminalModeSuccess )
+       {
+       // Error is returned
+       aAction->SetArgumentL( KAppTerminateResult,KStatusFalse );
+       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMAPPSERVERSERVICE_TERMINATEAPPACTIONL, "CUpnpTmAppServerService::TerminateAppActionL" );    
+       return TUpnpErrorCode( ret );
+       }
+   aAction->SetArgumentL( KAppTerminateResult,KStatusTrue); 
+   OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_TERMINATEAPPACTIONL_EXIT );
+   return EHttpOk;   
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::GetAppStatusActionL
+// @param aAction Pointer to upnp action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmAppServerService::GetAppStatusActionL( CUpnpAction* aAction )
+   {
+   OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL_ENTRY );
+   const TDesC8& appId= aAction->ArgumentValue(KAppId);
+   // Check if the appID argument has either wildcard character(*)
+   // or a valid integer as its value
+   TUint appIdInt;
+   if ( (( appId.Compare( KWildCard ) != KErrNone ) &&
+          ( ConvertDescriptorToInt( appId, appIdInt ) != KErrNone )) )
+        {
+        OstTrace1( TRACE_ERROR, CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL, "CUpnpTmAppServerService::GetAppStatusActionL;appIdInt=%u", appIdInt );
+        return EInvalidArgs; // invalid input argument
+        }
+   RBuf8 appStatusBuf;
+   CleanupClosePushL(appStatusBuf);
+   TTerminalModeErrorCode ret;
+   iTmServerImpl.GetAppStatusL( appId, appStatusBuf, ret);
+   
+   if ( ret != ETerminalModeSuccess )
+       {
+       CleanupStack::PopAndDestroy(&appStatusBuf);
+       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL, "CUpnpTmAppServerService::GetAppStatusActionL" );      
+       return TUpnpErrorCode( ret );
+       }
+   aAction->SetArgumentL( KAppStatus, appStatusBuf );
+   
+   CleanupStack::PopAndDestroy(&appStatusBuf);
+   OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_GETAPPSTATUSACTIONL_EXIT );
+   return EHttpOk;   
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::NewTransactionL
+// This method is invoked whenever http request related to icon file transfer
+// arrives to http server from remote client
+// @param aMethod Http message method ( GET, HEAD or POST )
+// @param aUri Http message request uri
+// @param aSender IP address of the Http message sender
+// @param[out] aTrans Returns newly created transaction object 
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::NewTransactionL( const TDesC8& aMethod, const TDesC8& aUri, 
+                          const TInetAddr& /*aSender*/, CUpnpHttpServerTransaction*& aResultTrans )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_NEWTRANSACTIONL_ENTRY );
+    if ( aMethod != KHttpPost() )
+        {
+        iTmServerImpl.GetIconInfoL(aUri, aResultTrans);
+        }
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_NEWTRANSACTIONL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::HttpEventLD
+// Provides file transfer completion status
+// Notifies about the HTTP events, errors.
+// Handling of http events is not provided in Terminal Mode Service
+// @param aMessage the HTTP message
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::HttpEventLD( CUpnpHttpMessage* /*aMessage*/ )
+    {
+
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::AppStatusUpdateEventL
+// Notifies the client about the status updates.
+// @param aStatusUpdateBuffer Buffer holding the update status information.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::AppStatusUpdateEventL( const TDesC8& aStatusUpdateBuffer )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_APPSTATUSUPDATEEVENTL_ENTRY );
+    SetStateVariableL( KArgTypeAppStatusUpdate, aStatusUpdateBuffer, EFalse );
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_APPSTATUSUPDATEEVENTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::AppListUpdateEventL
+// Notifies the client about the app list updates.
+// @param aListUpdateBuffer Buffer holding the update app list information.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmAppServerService::AppListUpdateEventL( const TDesC8& aListUpdateBuffer )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_APPLISTUPDATEEVENTL_ENTRY );
+    SetStateVariableL( KArgTypeAppListUpdate, aListUpdateBuffer, EFalse );   
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_APPLISTUPDATEEVENTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::ConvertDescriptorToInt
+// Utility method to convert descriptor's data to integer
+// @param aDes   Descriptor whose integer equivalent have to be calculated
+// @param aIntVal[out] Integer value
+// @return Returns error code
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmAppServerService::ConvertDescriptorToInt( const TDesC8& aDes, TUint& aIntVal )
+    {
+    OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_CONVERTDESCRIPTORTOINT_ENTRY );
+    aIntVal = KErrNone;
+    TLex8 lex( aDes );
+    OstTrace1( TRACE_NORMAL, CUPNPTMAPPSERVERSERVICE_CONVERTDESCRIPTORTOINT, "CUpnpTmAppServerService::ConvertDescriptorToInt;aIntVal=%u", aIntVal );
+    OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_CONVERTDESCRIPTORTOINT_EXIT );
+    return lex.Val(aIntVal);
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmclienticonpref.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,100 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmClientIconPref class implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "upnptmclienticonpref.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmclienticonprefTraces.h"
+#endif
+
+// Literal 
+_LIT8(KBmpMimeType,    "image/bmp");
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::NewL
+// Two-phased constructor.
+// @param aProfileId  ProfileID of the client profile.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C CUpnpTmClientIconPref* CUpnpTmClientIconPref::NewL( TUint aProfileId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTICONPREF_NEWL_ENTRY );
+    CUpnpTmClientIconPref* self = new (ELeave) CUpnpTmClientIconPref(aProfileId);    
+    CleanupStack::PushL(self);
+    self->ConstructL( );  
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMCLIENTICONPREF_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::CUpnpTmClientIconPref
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmClientIconPref::CUpnpTmClientIconPref( TUint aProfileId ):iClientProfileId(aProfileId),
+    iIconWidth(KErrNone),iIconHeight(KErrNone),iIconDepth(KDefaultDepthValue)
+   {
+   
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmClientIconPref::ConstructL( )
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTICONPREF_CONSTRUCTL_ENTRY );
+    iIconMimeType = KBmpMimeType().AllocL();
+    OstTraceFunctionExit0( CUPNPTMCLIENTICONPREF_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::~CUpnpTmClientIconPref
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmClientIconPref::~CUpnpTmClientIconPref()
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTICONPREF_CUPNPTMCLIENTICONPREF_ENTRY );
+    delete iIconMimeType;
+    OstTraceFunctionExit0( CUPNPTMCLIENTICONPREF_CUPNPTMCLIENTICONPREF_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::SetMimeTypeL
+// Method is used to provide the preferred mime type of the client.
+// @param aMimeType mime type of the icon
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmClientIconPref::SetMimeTypeL( const TDesC8& aMimeType )
+   {
+   OstTraceFunctionEntry0( CUPNPTMCLIENTICONPREF_SETMIMETYPEL_ENTRY );
+   delete iIconMimeType;
+   iIconMimeType = NULL;
+   iIconMimeType = aMimeType.AllocL();
+   OstTraceFunctionExit0( CUPNPTMCLIENTICONPREF_SETMIMETYPEL_EXIT );
+   }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmclientprofileservice.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,248 @@
+/**
+* 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: CUpnpTmClientProfileService class implementation.
+*
+*/
+
+// System includes
+#include <upnpdevice.h>
+#include <upnpservice.h>
+
+//User includes
+#include "upnptmclientprofileservice.h"
+#include "upnptmserverdevice.h"
+#include "upnptmserverimpl.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmclientprofileserviceTraces.h"
+#endif
+
+
+//Defines different action names ,their arguments and their related state variables
+_LIT8(KGetMaxNumProfiles,              "GetMaxNumProfiles");
+_LIT8(KSetClientProfile,               "SetClientProfile");
+_LIT8(KGetClientProfile,               "GetClientProfile");
+_LIT8(KProfileId,                      "profileID");
+_LIT8(KClientProfile ,                 "clientProfile");
+_LIT8(KResultProfile ,                 "resultProfile");
+_LIT8(KNumProfilesAllowed ,            "numProfilesAllowed");
+_LIT8(KArgTypeUnusedProfileIds,        "UnusedProfileIDs");
+_LIT8(KArgTypeClientProfile,           "A_ARG_TYPE_ClientProfile");
+_LIT8(KArgTypeMaxProfiles,             "MaxNumProfiles");
+_LIT8(KArgTypeProfileId,               "A_ARG_TYPE_ProfileID");
+
+
+// ================= MEMBER FUNCTIONS ==============================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::CUpnpTmClientProfileService
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmClientProfileService::CUpnpTmClientProfileService( CUpnpDevice& aUpnpDevice,CUpnpTmServerImpl& aTmServerImpl )
+    :CUpnpServiceImplementation(aUpnpDevice),iUpnpDevice(aUpnpDevice), iTmServerImpl(aTmServerImpl)
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_CUPNPTMCLIENTPROFILESERVICE_ENTRY );
+    
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_CUPNPTMCLIENTPROFILESERVICE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::~CUpnpTmClientProfileService
+// C++ default destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmClientProfileService::~CUpnpTmClientProfileService()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::ConstructL
+// Two-phased constructor.
+// Initialize variables, set parent service and create XML reader.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmClientProfileService::ConstructL(const TDesC& aDescriptionPath )
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_CONSTRUCTL_ENTRY );
+    _LIT8( KServiceType, "TmClientProfile:1" );
+    BaseConstructL( aDescriptionPath, KServiceType);
+
+    SetStateVariableL( KArgTypeUnusedProfileIds, KEmptyString, EFalse );
+    SetStateVariableL( KArgTypeClientProfile, KEmptyString, EFalse );
+    SetStateVariableL( KArgTypeMaxProfiles, KEmptyString, EFalse );
+    SetStateVariableL( KArgTypeProfileId, KEmptyString, EFalse );
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmClientProfileService* CUpnpTmClientProfileService::NewL(CUpnpDevice& aUpnpDevice, const TDesC& aDescriptionPath, CUpnpTmServerImpl& aTmServerImp )
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_NEWL_ENTRY );
+    CUpnpTmClientProfileService* clientProfileService = new (ELeave) CUpnpTmClientProfileService(aUpnpDevice, aTmServerImp);
+    CleanupStack::PushL( clientProfileService );
+    clientProfileService->ConstructL( aDescriptionPath );
+    CleanupStack::Pop( clientProfileService );
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_NEWL_EXIT );
+    return clientProfileService;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::ActionReceivedLD
+// @param aAction action received from the client
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmClientProfileService::ActionReceivedLD( CUpnpAction* aAction )
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_ACTIONRECEIVEDLD_ENTRY );
+    if ( !aAction )
+        {
+        User::Leave( KErrNotFound );
+        }
+    CleanupStack::PushL( aAction );
+    TUpnpErrorCode eCode = EHttpOk;
+    
+    // Get the name, saves calls in the if-else statements
+    TPtrC8 name( aAction->Name() );
+    // Verify the action and do the operation(s)
+    if ( name.Compare( KGetMaxNumProfiles ) == 0 )
+        {
+        eCode = GetMaxNumProfilesActionL( aAction );
+        }
+    else if ( name.Compare( KSetClientProfile ) == 0 )
+        {
+        eCode = SetClientProfileActionL( aAction );
+        }
+    else if ( name.Compare( KGetClientProfile ) == 0 )
+        {
+        eCode = GetClientProfileActionL ( aAction );
+        }
+    else
+        {
+        eCode = EInvalidAction;
+        }
+    SendL( aAction, eCode );
+    CleanupStack::PopAndDestroy( aAction );
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_ACTIONRECEIVEDLD_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::GetMaxNumProfilesActionL
+// @param aAction pointer to action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmClientProfileService::GetMaxNumProfilesActionL( CUpnpAction* aAction )
+   {
+   OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL_ENTRY );
+   TUint profileCount;
+   TTerminalModeErrorCode ret = iTmServerImpl.GetMaxNumProfiles( profileCount );
+   if ( ret != ETerminalModeSuccess ) 
+       {
+       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL, "CUpnpTmClientProfileService::GetMaxNumProfilesActionL" );
+       return TUpnpErrorCode( ret );       
+       } 
+   OstTrace1( TRACE_NORMAL, CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL, "CUpnpTmClientProfileService::GetMaxNumProfilesActionL;profileCount=%d", profileCount );      
+   TBuf8<UpnpString::KMaxTUintLength> countBuf;
+   countBuf.Num(profileCount);
+   
+   aAction->SetArgumentL( KNumProfilesAllowed, countBuf ); 
+   OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_GETMAXNUMPROFILESACTIONL_EXIT );
+   return EHttpOk;
+   }
+
+// -------------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::SetClientProfileActionL
+// @param aAction  Pointer to UPnP action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmClientProfileService::SetClientProfileActionL( CUpnpAction* aAction )
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_ENTRY );
+    TUint profileIdInt;
+    // Fetch the value for profile ID argument
+    TLex8 lex( aAction->ArgumentValue(KProfileId) );
+    lex.Val(profileIdInt);
+    OstTrace1( TRACE_ERROR, CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL;profileIdInt=%d", profileIdInt );      
+    
+    // Fetch the value for client profile argument
+    const TDesC8& clientProfile = aAction->ArgumentValue(KClientProfile);
+    
+    RBuf8 resultProfileBuf;
+    TTerminalModeErrorCode ret = iTmServerImpl.SetClientProfile( profileIdInt,clientProfile,resultProfileBuf );
+    if ( ret != ETerminalModeSuccess )
+       {
+       resultProfileBuf.Close();
+       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL" );
+       return TUpnpErrorCode( ret );
+       }
+    CleanupClosePushL(resultProfileBuf);
+    aAction->SetArgumentL( KResultProfile , resultProfileBuf );
+    CleanupStack::PopAndDestroy(&resultProfileBuf);
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_EXIT );
+    return EHttpOk;  
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientProfileService::GetClientProfileActionL
+// @param aAction pointer to action object
+// @return Returns upnp error code
+// ---------------------------------------------------------------------------------
+//
+TUpnpErrorCode CUpnpTmClientProfileService::GetClientProfileActionL( CUpnpAction* aAction )
+    { 
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_GETCLIENTPROFILEACTIONL_ENTRY );
+    TUint profileIdInt;
+    // Fetch the value for profile ID argument
+    TLex8 lex( aAction->ArgumentValue(KProfileId) );
+    lex.Val(profileIdInt);
+    OstTrace1( TRACE_ERROR, CUPNPTMCLIENTPROFILESERVICE_GETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::GetClientProfileActionL;profileIdInt=%d", profileIdInt );        
+
+    RBuf8 resultProfileBuf;
+    TTerminalModeErrorCode ret = iTmServerImpl.GetClientProfile(profileIdInt,resultProfileBuf );
+    
+    if ( ret != ETerminalModeSuccess )
+       {
+       resultProfileBuf.Close();
+       OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_GETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::GetClientProfileActionL" ); 
+       return TUpnpErrorCode( ret );
+       }
+    CleanupClosePushL(resultProfileBuf);
+    aAction->SetArgumentL( KClientProfile,resultProfileBuf ); 
+    CleanupStack::PopAndDestroy(&resultProfileBuf);
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_GETCLIENTPROFILEACTIONL_EXIT );
+    return EHttpOk;   
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmAppServerService::UnusedProfileIdEventL
+// Notifies the client about the status updates.
+// @param aUnusedProfileIdBuffer Buffer holding the unused profile IDs information.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmClientProfileService::UnUsedProfileIdEventL(const TDesC8& aUnusedProfileIdBuffer)
+    {
+    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_UNUSEDPROFILEIDEVENTL_ENTRY );
+    SetStateVariableL( KArgTypeUnusedProfileIds, aUnusedProfileIdBuffer, EFalse);
+    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_UNUSEDPROFILEIDEVENTL_EXIT );
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmfilteredapplist.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,654 @@
+/**
+* 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: CUpnpTmFilteredAppList class implementation.
+*
+*/
+
+#include "upnptmfilteredapplist.h"
+#include "upnptmserverimpl.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmfilteredapplistTraces.h"
+#endif
+
+//Constants
+const TUint  KQuote            =     '"';
+const TUint  KCommaSeparator   =     ',';
+
+//Literals
+_LIT8(KDoubleQuote,        "\"\"");
+_LIT8(KIconElement,        "icon");
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmFilteredAppList* CUpnpTmFilteredAppList::NewL( CUpnpTmServerImpl& aTmServerImpl )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_NEWL_ENTRY );
+    CUpnpTmFilteredAppList* self = new (ELeave) CUpnpTmFilteredAppList( aTmServerImpl );   
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_NEWL_EXIT );
+    return self;  
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::CUpnpTmFilteredAppList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmFilteredAppList::CUpnpTmFilteredAppList( CUpnpTmServerImpl& aTmServerImpl )
+                                                   :iTmServerImpl (aTmServerImpl )
+     {
+
+     }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmFilteredAppList::ConstructL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_CONSTRUCTL_ENTRY );
+    iFilterInfo = CUpnpAppFilterInfo::NewL();
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::~CUpnpTmFilteredAppList
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmFilteredAppList::~CUpnpTmFilteredAppList()
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_CUPNPTMFILTEREDAPPLIST_ENTRY );
+    delete iFilterInfo;
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_CUPNPTMFILTEREDAPPLIST_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::ParseAppFilterStringL
+// Method parses the descriptor containing the filter string
+// It parses the comma-separated list of A_ARG_TYPE_AppList schema 
+// elements, attributes and their values
+// eg: "name="*Audio*",description="*",icon@mimetype="*svg+xml*", remotingInfo@protocolID="*",
+//     appInfo@appCategory="*",audioInfo@audioType="*",resourceStatus="free",signature="*""
+// @param aAppFilter Buffer containing application filter string
+// @param aErr[out]  Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmFilteredAppList::ParseAppFilterStringL( const TDesC8& aAppFilter, 
+                                                     TTerminalModeErrorCode& aErr )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_PARSEAPPFILTERSTRINGL_ENTRY );
+    // Validate the filter string
+    aErr = ETerminalModeSuccess;
+    TInt quotePos = aAppFilter.Locate( KQuote );
+    if ( ( quotePos != 0 ) || ( aAppFilter.Find(KDoubleQuote) == KErrNotFound ))    
+        {
+        // corrupt filter string
+        aErr = ETerminalModeInvalidArgument;
+        OstTrace1( TRACE_ERROR, DUP2_CUPNPTMFILTEREDAPPLIST_PARSEAPPFILTERSTRINGL, "CUpnpTmFilteredAppList::ParseAppFilterStringL;quotePos=%d", quotePos );
+        return;
+        }
+    RBuf8 filterBuffer;
+    CleanupClosePushL(filterBuffer);
+    /* Create a buffer having the content of AppFilter buffer but without 
+       the leading quote(")  */ 
+    filterBuffer.CreateL(aAppFilter.Mid(quotePos+1));
+    TInt equalToQuoteToken;
+    while( ( equalToQuoteToken = filterBuffer.Find(Keq)) != KErrNotFound )
+        {
+        // Fetch the full key string
+        TPtrC8 key = filterBuffer.Left(equalToQuoteToken);
+        // Check for the presence of sub element by checking the @ in the key string
+        TInt atTokenPos = key.Find(KAtToken);
+        TBool displayInfo(EFalse);
+        if ( atTokenPos != KErrNotFound )
+            {
+            // @ is found in the key string
+            // Now extract the parent element
+            TPtrC8 parentKey = key.Left(atTokenPos);
+            //Remove any leading and trailing whitespaces in the parent element
+            const TDesC8& parentKeyWithoutSpace = RemoveWhiteSpace(parentKey);
+            // Check if the parent elemet is one of desired element or not.
+            // It should be one of the following :
+            // <1> icon <2> remotingInfo <3> appInfo <4> displayInfo <5> audioInfo
+            if ( ( parentKeyWithoutSpace.Compare(KIconElement) != KErrNone ) &&
+                ( parentKeyWithoutSpace.Compare(KRemotingInfo) != KErrNone ) &&
+                ( parentKeyWithoutSpace.Compare(KAppInfo) != KErrNone ) &&
+                ( parentKeyWithoutSpace.Compare(KDisplayInfo) != KErrNone ) &&
+                ( parentKeyWithoutSpace.Compare(KAudioInfo) != KErrNone ) )
+                {
+                // parent element is not proper
+                aErr = ETerminalModeInvalidArgument;   
+                break;
+                }
+            if ( parentKeyWithoutSpace.Compare(KDisplayInfo) == KErrNone )
+                {
+                // The parent key element is displayInfo
+                displayInfo = ETrue;   
+                }
+            // Fetch the actual key name ( child element )
+            key.Set(key.Mid(atTokenPos+1));
+            }
+        
+        //Remove any leading and trailing whitespaces in the key 
+        const TDesC8& keyWithoutSpace = RemoveWhiteSpace(key);
+        if ( (filterBuffer.Mid(equalToQuoteToken) ).Locate(KQuote) != 1 )
+            {
+            // Missing quote(") ahead of the value
+            aErr = ETerminalModeInvalidArgument;
+            break;    
+            }
+        TPtrC8 bufPtr = filterBuffer.Mid(equalToQuoteToken+2);
+        quotePos = bufPtr.Locate( KQuote );
+        if ( quotePos == KErrNotFound )
+            {
+            // missing quote (") at the end of the value
+            aErr = ETerminalModeInvalidArgument;
+            break;
+            }
+        
+        /* Add the filter info as key-value pairs.
+        // Also check if the parent key is display info.
+           If display info flag is true then use the method with non default parameter */
+        if ( displayInfo )
+            {
+            iFilterInfo->SetFilterInfoL( keyWithoutSpace, bufPtr.Left(quotePos), aErr, ETrue );
+            }
+        else
+            {
+            // Use the method with default parameter
+            iFilterInfo->SetFilterInfoL( keyWithoutSpace, bufPtr.Left(quotePos), aErr );   
+            }
+        if ( aErr != ETerminalModeSuccess )
+            {
+            // Return the error code in case the key element is not as per the schema
+            aErr = ETerminalModeInvalidArgument;
+            break;
+            }
+        // Skip the quote position and set the buffer
+        bufPtr.Set(bufPtr.Mid(quotePos+1));
+        if ( ( bufPtr.Locate(KCommaSeparator) != 0 ) && ( bufPtr.Locate(KQuote) != 0 ) )
+            {
+            //  missing quote (") or comma (,) following the quote.
+            //  Expected to be something of this kind ( ", or "" )
+            aErr = ETerminalModeInvalidArgument;
+            break;      
+            }
+        //Copy the residual content skipping two characters(", or "" ) in the actual buffer
+        filterBuffer.Copy(bufPtr.Mid(UpnpString::KLinefeedLength));
+        }
+    CleanupStack::PopAndDestroy(&filterBuffer);
+    OstTrace1( TRACE_FLOW, CUPNPTMFILTEREDAPPLIST_PARSEAPPFILTERSTRINGL, "CUpnpTmFilteredAppList::ParseAppFilterStringL;aErr=%d", aErr );
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_PARSEAPPFILTERSTRINGL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::ConstructFilteredGetAppListResponseL
+// Constructs the GetApplicationList action response buffer satisfying 
+// the AppListingFilter criteria
+// @param aAppIndex Index the registered application 
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmFilteredAppList::ConstructFilteredGetAppListResponseL( TInt aAppIndex )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_CONSTRUCTFILTEREDGETAPPLISTRESPONSEL_ENTRY );
+    const TDesC8& filterAppName = iFilterInfo->AppName();
+    const TDesC8& filterAppDesc = iFilterInfo->AppDescription();
+    if ( ( ( filterAppName.Length() == 0 ) || 
+          ((iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).AppName()).MatchC(filterAppName)  
+          != KErrNotFound )) && (( filterAppDesc.Length() == 0 ) ||
+          ((iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).AppDescription()).MatchC(filterAppDesc) 
+            != KErrNotFound )))
+            {
+            /**
+             * 1. Either required appName element is unavailable in the filter string or the desired appName matches.
+             * 2. Either optional appDescription element is unavailable in the filter string
+             *    or the desired appDescription element matches
+             */ 
+            const RPointerArray<CUpnpTmInfoElement>& tmInfoElementList = 
+                          iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).TmInfoElementList();  
+            TInt tmInfoCount = tmInfoElementList.Count();
+            // Check if terminal mode info is also available in the filter string
+            TInt match(KErrNone);
+            for ( TInt i(0); i < tmInfoCount; i++ )
+                {
+                if ( TerminalModeInfoMatchingL( *tmInfoElementList[i]) )
+                    {
+                    match++;
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+            if ( match == tmInfoCount )
+                {      
+                // Check if resource status and xm signature elements are available in the filter
+                const TDesC8& filterRscStatus = iFilterInfo->ResourceStatus();
+                const TDesC8& filterSignature = iFilterInfo->Signature(); 
+                if ( (( filterRscStatus.Length() == 0 ) || 
+                    ((iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).ResourceStatus()).MatchC(filterRscStatus) 
+                      != KErrNotFound)) && ( ( filterSignature.Length() == 0 ) ||
+                      ((iTmServerImpl.XmlSignature()).MatchC(filterSignature) != KErrNotFound)) )
+                    {
+                    IconMatchingL( aAppIndex );
+                    }                
+                }
+            }
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_CONSTRUCTFILTEREDGETAPPLISTRESPONSEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::TerminalModeInfoMatchingL
+// The method checks if the terminal mode info element is present in the filter string
+// If available then it compares with each of the desired key-value of a particular 
+// info element.
+// @param aTmInfoElement Reference to Terminal Mode Info Element object
+// @return Returns a boolean value ( ETrue/EFalse )
+// ---------------------------------------------------------------------------------
+//
+TBool CUpnpTmFilteredAppList::TerminalModeInfoMatchingL( const CUpnpTmInfoElement& aTmInfoElement )const
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_TERMINALMODEINFOMATCHING_ENTRY );
+    TBool match(EFalse);
+    // First check for terminal mode info type
+    const TDesC8& infoType = aTmInfoElement.TerminalModeInfoType();
+    /**
+     * info Type must be either one of these
+     * <1> Remoting Info <2> App Info <3> Display Info <4> Audio Info
+     * 
+     */
+    if ( ( infoType.Compare(KRemotingInfo) == KErrNone ) ||( infoType.Compare(KAppInfo) == KErrNone )
+       || ( infoType.Compare(KDisplayInfo) == KErrNone ) || ( infoType.Compare(KAudioInfo) == KErrNone ))
+        {
+        for ( TInt j(0); j < aTmInfoElement.TmInfoElementCount(); j++ )
+            {
+            match = TmInfoElementMatchingL( aTmInfoElement,j );
+            if ( !match )
+                {
+                break;
+                }
+            }
+        }
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_TERMINALMODEINFOMATCHING_EXIT );
+    return match;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::TmInfoElementMatchingL
+// Method is used to compare with each of the desired key-value of a particular
+// info element.
+// @param aTmInfoElement Reference to Terminal Mode Info Element object.
+// @return Returns the boolean value ( ETrue/EFalse )
+// ---------------------------------------------------------------------------------
+//
+TBool CUpnpTmFilteredAppList::TmInfoElementMatchingL( const CUpnpTmInfoElement& aTmInfoElement,
+                                                                            TInt aIndex )const
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_TMINFOELEMENTMATCHINGL_ENTRY );
+    TBool match(EFalse);
+    RBuf8 elementName;
+    CleanupClosePushL(elementName);
+    RBuf8 elementValue;
+    CleanupClosePushL(elementValue);
+    aTmInfoElement.GetTmInfoElementL(elementName,elementValue,aIndex );
+    // Check for required "protocolID" element
+    if ( elementName.Compare(KProtocolId()) == KErrNone ) 
+     {
+     const TDesC8& filterProtocol = iFilterInfo->ProtocolId();
+     if ( ( filterProtocol.Length() == KErrNone) || 
+         elementValue.MatchC(filterProtocol) != KErrNotFound )
+         {
+         // Either protocolID( required element )is unavailable or desired 
+         // protocolID matches
+         match = ETrue;     
+         }
+     }
+    // Check for optional "format" element
+    else if ( elementName.Compare(KFormat()) == KErrNone ) 
+         {
+         const TDesC8& filterFormat = iFilterInfo->Format();
+         if ( ( filterFormat.Length() == KErrNone) || 
+             elementValue.MatchC(filterFormat) != KErrNotFound )  
+             {
+             // Either format ( optional element )is unavailable or desired "format" matches
+             match = ETrue;   
+             }
+         }
+    // Check for optional "direction" element
+    else if ( elementName.Compare(KRemotingDirection()) == KErrNone ) 
+         {
+         const TDesC8& filterDirection = iFilterInfo->Direction();
+         if ( ( filterDirection.Length() == KErrNone) || 
+             elementValue.MatchC(filterDirection) != KErrNotFound )  
+             {
+             // Either direction ( optional element )is unavailable or desired "direction" matches
+             match = ETrue;      
+             }
+         }
+    // Check for optional "appCategory" element
+    else if ( elementName.Compare(KAppCategory()) == KErrNone ) 
+         {
+         const TDesC8& filterAppCategory = iFilterInfo->AppCategory(); 
+         if ( ( filterAppCategory.Length() == KErrNone) || 
+             elementValue.MatchC(filterAppCategory) != KErrNotFound )
+             {
+             // Either appCategory ( optional element )is unavailable or desired "appCategory" matches
+             match = ETrue;     
+             }
+         }
+    // Check for optional "trustLevel" element for App Info Type
+    else if ( ( elementName.Compare(KTrustLevel()) == KErrNone ) &&
+                           ( aTmInfoElement.TerminalModeInfoType() == KAppInfo()) )
+         {
+         const TDesC8& filterAppTrustLevel = iFilterInfo->AppTrustLevel();
+         if ( ( filterAppTrustLevel.Length() == KErrNone) || 
+             elementValue.MatchC(filterAppTrustLevel) != KErrNotFound )
+             {
+             // Either trustLevel ( optional element )is unavailable or desired "trustLevel" matches
+             match = ETrue;    
+             }
+     }
+    // Check for optional "contentCategory" element
+    else if ( elementName.Compare(KContCategory()) == KErrNone ) 
+         {
+         const TDesC8& filterContCategory = iFilterInfo->ContentCategory();
+         if ( ( filterContCategory.Length() == KErrNone) || 
+             elementValue.MatchC(filterContCategory) != KErrNotFound )
+             {
+             // Either contentCategory ( optional element )is unavailable or desired
+             // "contentCategory" matches
+             match = ETrue;     
+             }
+         }
+    // Check for optional "contentRules" element
+    else if ( elementName.Compare(KContentRules()) == KErrNone ) 
+         {
+         const TDesC8& filterContentRules = iFilterInfo->ContentRules();
+         if ( ( filterContentRules.Length() == KErrNone) || 
+             elementValue.MatchC(filterContentRules) != KErrNotFound )
+             {
+             // Either contentRules ( optional element )is unavailable or desired "contentRules" matches
+             match = ETrue;  
+             }
+         }
+    // Check for optional "trustLevel" element for Display Info type
+    else if ( ( elementName.Compare(KTrustLevel()) == KErrNone ) &&
+                        ( aTmInfoElement.TerminalModeInfoType() == KDisplayInfo()) )
+         {
+         const TDesC8& filterContTrustLevel = iFilterInfo->ContentTrustLevel();
+         if ( ( filterContTrustLevel.Length() == KErrNone) || 
+             elementValue.MatchC(filterContTrustLevel) != KErrNotFound )
+             {
+             // Either trustLevel ( optional element )is unavailable or desired "trustLevel" matches
+             match = ETrue;  
+             }
+         }
+    // Check for optional "audioType" element
+    else if ( elementName.Compare(KAudioType()) == KErrNone ) 
+         {
+         const TDesC8& filterAudioType = iFilterInfo->AudioType();
+         if ( ( filterAudioType.Length() == KErrNone) || 
+             elementValue.MatchC(filterAudioType) != KErrNotFound )
+             {
+             // Either audioType ( optional element )is unavailable or desired "audioType" matches
+             match = ETrue;     
+             }
+         }
+    CleanupStack::PopAndDestroy(2,&elementName);
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_TMINFOELEMENTMATCHINGL_EXIT );
+    return match;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::IconMatchingL
+// The method checks if the optional icon element is present in the filter string
+// If present then it compares with the icon of the given application
+// @param aAppIndex index of the registered app
+// @param aAppStore reference to CUpnpRemotableAppStore object
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmFilteredAppList::IconMatchingL( TInt aAppIndex )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_ICONMATCHINGL_ENTRY );
+    const TDesC8& mimeType = iFilterInfo->MimeType();
+    const TDesC8& width = iFilterInfo->Width();
+    const TDesC8& height = iFilterInfo->Height();
+    const TDesC8& depth = iFilterInfo->Depth(); 
+    const RPointerArray<CUpnpTerminalModeIcon>& iconList = 
+                           iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).IconList();
+    TInt iconCount = iconList.Count();
+    if( ( iconCount == 0 ) || 
+            (( mimeType.Length() == 0 ) && ( width.Length() == 0 ) && 
+                              ( height.Length() == 0 ) && ( depth.Length() == 0 )))
+         {
+         /* Match is found and the given application needs to be there 
+            in the response with no optional icon element */
+         ConstructFilteredResponseL( aAppIndex );
+         }
+    else 
+         {
+         for ( TInt k(0); k < iconCount; k++ )
+             {   
+             if ( IconLookUp( *iconList[k] ))
+                 {
+                 /* Match is found and the given application needs to be there 
+                    in the response with the icon element to be present */
+                 ConstructFilteredResponseL( aAppIndex );
+                 break;
+                 }
+             }
+         }   
+    OstTraceFunctionExit0( DUP1_CUPNPTMFILTEREDAPPLIST_ICONMATCHINGL_EXIT );
+    }
+                              
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::ConstructFilteredResponseL
+// Constructs the filtered soap response buffer for GetApplicationList action
+// @param aAppIndex index the registered application 
+// @param aAppStore  Reference to CUpnpRemotableAppStore object
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmFilteredAppList::ConstructFilteredResponseL( TInt aAppIndex )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_CONSTRUCTFILTEREDRESPONSEL_ENTRY );
+    iTmServerImpl.ConstructLeadingSoapBufferL(aAppIndex);
+    const TDesC8& appDesc = iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).AppDescription();
+    if (  ( iFilterInfo->AppDescription().Length() != KErrNone )  
+                                                && ( appDesc.Length() != KErrNone ) )
+         {
+         // Appends the optional application desciption element
+         iTmServerImpl.AppendDataL(KStartNameDesc);
+         iTmServerImpl.AppendDataL(appDesc);
+         iTmServerImpl.AppendDataL(KEndNameDesc);   
+         }  
+    const TDesC8& mimeType = iFilterInfo->MimeType();
+    const TDesC8& width = iFilterInfo->Width();
+    const TDesC8& height = iFilterInfo->Height();
+    const TDesC8& depth = iFilterInfo->Depth(); 
+    if (( mimeType.Length() != KErrNone ) || ( width.Length() != KErrNone ) || 
+                         ( height.Length() != KErrNone ) || ( depth.Length() != KErrNone ))
+        {  
+        // Even if any one of the matching optional child element of the icon element is present 
+        // in the filter string,we will return the complete icon information related to that icon
+        const RPointerArray<CUpnpTerminalModeIcon>& iconList = 
+                                 iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).IconList();
+        TInt iconCount = iconList.Count();
+        if ( iconCount > KErrNone )
+            {
+            // Appends the optional icon element
+            iTmServerImpl.AppendDataL(KStartIconList);
+            for ( TInt i(0); i < iconCount; i++ )
+                {   
+                if ( IconLookUp( *iconList[i] ))
+                    {
+                    iTmServerImpl.SetRemotableAppIconInfoL( *iconList[i] );
+                    }
+                }
+            iTmServerImpl.AppendDataL(KEndIconList);
+            }
+        }
+    // Appends allowed profile ID list
+    if ( iFilterInfo->AllowedProfileIdList().Length() != KErrNone )
+        {
+        iTmServerImpl.SetAllowedProfileIdListL(aAppIndex);
+        }
+    
+    // Appends the different associated terminal mode info elements
+    const TDesC8& filterAppCategory = iFilterInfo->AppCategory(); 
+    const TDesC8& filterAppTrustLevel = iFilterInfo->AppTrustLevel();
+    const TDesC8& filterContCategory = iFilterInfo->ContentCategory();
+    const TDesC8& filterContentRules = iFilterInfo->ContentRules();
+    const TDesC8& filterContTrustLevel = iFilterInfo->ContentTrustLevel();
+    const TDesC8& filterAudioType = iFilterInfo->AudioType();
+    
+    const RPointerArray<CUpnpTmInfoElement>& tmInfoElementList = 
+                      iTmServerImpl.iAppStore->FetchRemotableApp(aAppIndex).TmInfoElementList();
+    /**
+     * Case 1. In case of matching child elements of remotingInfo ,all the child elements of the
+     *         remotingInfo element are sent in the response as protocolID is a required element.
+     * Case 2. In case of matching child elements of appInfo,displayInfo or audioInfo ,if one or 
+     *         more of the optional child element is available in the filter string,then all
+     *         the optional child elements for that info element will be sent in the response.
+     */  
+    for ( TInt j(0); j < tmInfoElementList.Count(); j++)
+        {
+        /**
+         * No checking for availabilty of child elements of remotingInfo is needed , because 
+         * protocolID( child element of remotingInfo ) is required/must element in the response
+         * and as per the rule even if one child element is present in the filter string,
+         * all other optional child elements of their parent info element too will be sent.
+         */  
+        if ( ( tmInfoElementList[j]->TerminalModeInfoType() == KRemotingInfo ) ||
+            ( ( tmInfoElementList[j]->TerminalModeInfoType() == KAppInfo ) && 
+              (( filterAppCategory.Length() != KErrNone ) || (filterAppTrustLevel.Length() != KErrNone ))) ||
+            ( ( tmInfoElementList[j]->TerminalModeInfoType() == KDisplayInfo ) && 
+             (( filterContCategory.Length() != KErrNone ) || (filterContentRules.Length() != KErrNone ) || 
+             (filterContTrustLevel.Length() != KErrNone ) )) || ( ( tmInfoElementList[j]->TerminalModeInfoType() == KAudioInfo ) 
+               && ( filterAudioType.Length() != KErrNone )))
+            {
+            // Called for each terminal mode element associated with the App
+            iTmServerImpl.SetTerminalModeInfoElementL( *tmInfoElementList[j] );
+            }
+        }
+    // Appends resource status element for the app if it is available
+    if ( iFilterInfo->ResourceStatus().Length() != KErrNone ) 
+        {
+        iTmServerImpl.SetResourceStatusL(aAppIndex);
+        }
+    // End of an application
+    iTmServerImpl.AppendDataL(KEndApp);
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_CONSTRUCTFILTEREDRESPONSEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::IconLookUp
+// Performs the icon look up
+// Checks if the requested icon and given icon matches
+// @param aIcon Reference to the Terminal Mode Icon object
+// @return Returns boolean value(true or false)
+// ---------------------------------------------------------------------------------
+//
+TBool CUpnpTmFilteredAppList::IconLookUp( CUpnpTerminalModeIcon& aIcon  )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_ICONLOOKUP_ENTRY );
+    TBool matchFound(EFalse);
+    const TDesC8& filterMimeType = iFilterInfo->MimeType();
+    const TDesC8& filterWidth = iFilterInfo->Width();
+    const TDesC8& filterHeight = iFilterInfo->Height();
+    const TDesC8& filterDepth = iFilterInfo->Depth(); 
+
+    // Check whether the icon is meant to be used only at launch time
+    TBuf8<UpnpString::KShortStringLength> widthBuf;
+    widthBuf.Num(aIcon.Width());
+    TBuf8<UpnpString::KShortStringLength> heightBuf;
+    heightBuf.Num(aIcon.Height());
+    TBuf8<UpnpString::KShortStringLength> depthBuf;
+    depthBuf.Num(aIcon.Depth());
+    /* Check if the icon in provided in the input filter string, and if so
+       then does it match with the desired icon ( type and dimension ) */
+    if ( (( filterMimeType.Length() == 0 ) ||( (aIcon.MimeType()).MatchC(filterMimeType) != KErrNotFound))
+         && (( filterWidth.Length() == 0 ) ||( widthBuf.MatchC(filterWidth) != KErrNotFound))
+         && (( filterHeight.Length() == 0 ) ||( heightBuf.MatchC(filterHeight) != KErrNotFound))
+         && (( filterDepth.Length() == 0 ) ||( depthBuf.MatchC(filterDepth) != KErrNotFound)))
+            {
+            matchFound = ETrue;
+            }
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_ICONLOOKUP_EXIT );
+    return matchFound;
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used to check whether signature element is needed in the response
+// to GetApplicationList action or not
+// ---------------------------------------------------------------------------------
+const TDesC8& CUpnpTmFilteredAppList::SignatureElement()const
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_GETSIGNATUREELEMENT_ENTRY );
+    return iFilterInfo->Signature(); 
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmFilteredAppList::RemoveWhiteSpace
+// Method is used to remove leading and trailing whitespaces from the descriptor's data
+// @param aData Descriptor's data from which whitespaces have to be removed
+// @return Returns the descriptor having no white spaces
+// ---------------------------------------------------------------------------------
+//
+const TDesC8& CUpnpTmFilteredAppList::RemoveWhiteSpace( TPtrC8& aData )
+    {
+    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_REMOVEWHITESPACE_ENTRY );
+    // Removes the leading white spaces
+    TInt length = aData.Length();
+    TInt i = 0;
+    TBool done = EFalse;
+    while( !done && i < length )
+        {
+        TChar current = aData[i];
+        done  = !current.IsSpace();
+        if( !done )
+        ++i;
+        }
+    aData.Set(aData.Mid(i)); /* aData now does not have any white space character 
+                                ahead of its actual data */
+    
+    // Removes the trailing white spaces
+    length = aData.Length();
+    i = 0;
+    done = EFalse;
+    while( !done && i < length )
+        {
+        TChar current = aData[(length-1) - i];
+        done  = !current.IsSpace();
+        if( !done )
+        ++i;
+        }
+    aData.Set(aData.Left(aData.Length() - i)); /* aData now does not have any white space character
+                                                following the actual data */
+    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_REMOVEWHITESPACE_EXIT );
+    return aData;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmiconmapping.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,197 @@
+/**
+* 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: CUpnpTmIconMapping class implementation.
+*
+*/
+
+//Include Files  
+
+#include "upnptmiconmapping.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmiconmappingTraces.h"
+#endif
+   
+
+_LIT8(KSvgMimeType,     "image/svg+xml");  
+
+// ================= MEMBER FUNCTIONS ==============================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmIconMapping* CUpnpTmIconMapping::NewL( )
+    {
+    OstTraceFunctionEntry0( CUPNPTMICONMAPPING_NEWL_ENTRY );
+    CUpnpTmIconMapping* self = new (ELeave) CUpnpTmIconMapping(); 
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMICONMAPPING_NEWL_EXIT );
+    return self; 
+    }
+
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::CUpnpTmIconMapping
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmIconMapping::CUpnpTmIconMapping( )
+     {
+
+     }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmIconMapping::ConstructL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMICONMAPPING_CONSTRUCTL_ENTRY );
+    iFileUrlArray = new ( ELeave ) CDesC8ArrayFlat( KExpectedMaxIconParms  );
+    iFilePathArray = new ( ELeave ) CDesCArrayFlat( KExpectedMaxIconParms );
+    OstTraceFunctionExit0( CUPNPTMICONMAPPING_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::~CUpnpTmIconMapping
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmIconMapping::~CUpnpTmIconMapping()
+    {
+    OstTraceFunctionEntry0( CUPNPTMICONMAPPING_CUPNPTMICONMAPPING_ENTRY );
+    if ( iFileUrlArray )
+        {
+        iFileUrlArray->Reset();
+        delete iFileUrlArray;
+        }
+    if ( iFilePathArray )
+        {
+        iFilePathArray->Reset();
+        delete iFilePathArray;
+        }   
+    iWidthArray.Close();
+    iHeightArray.Close();
+    OstTraceFunctionExit0( CUPNPTMICONMAPPING_CUPNPTMICONMAPPING_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::AddIconFileInfoL
+// Method is used to store information about each application icon which can be 
+// used to fetch iconPath for the corresponding iconUrl and to determine whether  
+// conversion is needed or not.
+// @param aUrl     Iccon URL.
+// @param aPath    Icon Path.
+// @param aWidth   Width of the icon.
+// @param aHeight  Height of the icon.
+// -------------------------------------------------------------------------------------
+//
+void CUpnpTmIconMapping::AddIconFileInfoL( const TDesC8& aUrl, const TDesC& aPath, 
+                                                        TInt aWidth, TInt aHeight )
+    {
+    OstTraceFunctionEntry0( CUPNPTMICONMAPPING_ADDICONFILEINFOL_ENTRY );
+    iFileUrlArray->AppendL( aUrl );
+    iFilePathArray->AppendL( aPath );
+    iWidthArray.AppendL( aWidth );
+    iHeightArray.AppendL( aHeight );
+    OstTraceFunctionExit0( CUPNPTMICONMAPPING_ADDICONFILEINFOL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::GetSvgIconPath
+// Method is used to fetch the equivalent icon path for the requested icon url
+// @param aUrl  iconUrl
+// @param aSvgFilePath[out]  iconPath
+// @return   Returns the position of the filepath in the array if found else 
+//           returns KErrNotFound.
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmIconMapping::GetSvgIconPath( const TDesC8& aUrl,RBuf& aSvgFilePath )
+    {
+    OstTraceFunctionEntry0( CUPNPTMICONMAPPING_GETSVGICONPATH_ENTRY );
+    TInt pos;
+    if ( iFileUrlArray->Find(aUrl,pos) == KErrNone )
+        {
+        aSvgFilePath.Close();
+        aSvgFilePath.Create((*iFilePathArray)[pos]);
+        }
+    else
+        {
+        // The requested file is not available
+        pos = KErrNotFound;
+        }
+    OstTraceFunctionExit0( CUPNPTMICONMAPPING_GETSVGICONPATH_EXIT );
+    return pos;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmIconMapping::IsConversionNeeded
+// Method is used to fetch the dimensions of the icon which needs to be served and 
+// also return the information whether conversion is needed for a particular icon.
+// @param aIndex   Index of the icon filepath
+// @param aClientIconPref   Reference to Client Icon Preference object.
+// @param[out] aIconWidth   Width of the icon which needs to be sent.
+// @param[out] aIconHeight  Height of the icon which needs to be sent.
+// @return  Returns the boolean value for conversion is needed(true) or not(false).
+// ---------------------------------------------------------------------------------
+//
+TBool CUpnpTmIconMapping::IsConversionNeeded( TInt aIndex, const CUpnpTmClientIconPref& aClientIconPref,
+                                                                   TInt& aIconWidth, TInt& aIconHeight )
+    {
+    OstTraceFunctionEntry0( CUPNPTMICONMAPPING_ISCONVERSIONNEEDED_ENTRY );
+    ASSERT( ( aIndex >= 0 ) && ( aIndex < iWidthArray.Count()) );
+    TBool isConversionNeeded(ETrue);
+    // Fetch the client's icon preferences
+    const TDesC8& mimeType = aClientIconPref.MimeType();
+    TInt iconWidth  = aClientIconPref.Width();
+    TInt iconHeight = aClientIconPref.Height();
+    OstTraceExt2( TRACE_NORMAL, DUP1_CUPNPTMICONMAPPING_ISCONVERSIONNEEDED, "CUpnpTmIconMapping::IsConversionNeeded;iconWidth=%d;iconHeight=%d", iconWidth, iconHeight );
+
+    if ( mimeType.Compare(KSvgMimeType) == KErrNone )
+        {
+        // Client supports "image/svg+xml" mime type icons
+        if ((( iconWidth == KErrNone ) || ( iconWidth == iWidthArray[aIndex] )) && 
+            (( iconHeight == KErrNone ) || ( iconHeight == iHeightArray[aIndex] )))
+            {
+            /* Either the client has not provided its dimension preferences or 
+               preferred width and height also matches. So no conversion needed */
+            isConversionNeeded = EFalse;
+            }
+        }
+    /* 
+     * If the width and height fields are set properly then only use the client's 
+     * specified icon dimensions else use the icon's original dimensions.
+     */
+    if ( isConversionNeeded && iconWidth && iconHeight )
+        {
+        // Use the dimensions specified by the client
+        aIconWidth  = iconWidth;
+        aIconHeight = iconHeight;  
+        }
+    else
+        {
+        // Use original dimensions
+        aIconWidth  = iWidthArray[aIndex];
+        aIconHeight = iHeightArray[aIndex]; 
+        } 
+    OstTraceExt2( TRACE_NORMAL, CUPNPTMICONMAPPING_ISCONVERSIONNEEDED, "CUpnpTmIconMapping::IsConversionNeeded;aIconWidth=%d;aIconHeight=%d", aIconWidth, aIconHeight );
+    OstTraceFunctionExit0( CUPNPTMICONMAPPING_ISCONVERSIONNEEDED_EXIT );
+    return isConversionNeeded;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptminfoelement.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,161 @@
+/**
+* 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: CUpnpTmInfoElement class implementation.
+*
+*/
+
+//  Include Files  
+#include "upnptminfoelement.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptminfoelementTraces.h"
+#endif
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmInfoElement* CUpnpTmInfoElement::NewL( TTerminalModeInfoType aTerminalModeInfoType )
+    {
+    OstTraceFunctionEntry0( CUPNPTMINFOELEMENT_NEWL_ENTRY );
+    CUpnpTmInfoElement* self = new (ELeave) CUpnpTmInfoElement();   
+    CleanupStack::PushL(self);
+    self->ConstructL( aTerminalModeInfoType );
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMINFOELEMENT_NEWL_EXIT );
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::CUpnpTmInfoElement
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmInfoElement::CUpnpTmInfoElement( )
+     {
+
+     }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::ConstructL
+// Symbian 2nd phase constructor can leave.
+// @param aTerminalModeInfoType    Type of info element. Enum value.
+// @see TTerminalModeInfoType enumeration
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmInfoElement::ConstructL(  TTerminalModeInfoType aTerminalModeInfoType )
+    {
+    OstTraceFunctionEntry0( CUPNPTMINFOELEMENT_CONSTRUCTL_ENTRY );
+    switch( aTerminalModeInfoType )
+        {
+        case ERemotingInfo:
+            {
+            iInfoTypeBuffer = KRemotingInfo().AllocL();     
+            }
+            break;
+        case EAppInfo:
+            {
+            iInfoTypeBuffer =  KAppInfo().AllocL();          
+            }
+            break;
+        case EDisplayInfo:
+            {
+            iInfoTypeBuffer = KDisplayInfo().AllocL();           
+            }
+            break;
+        case EAudioInfo:
+            {
+            iInfoTypeBuffer = KAudioInfo().AllocL();           
+            }
+            break;
+        default: 
+            {
+            // Undefined. Should not come here at all.
+            User::Leave(KErrArgument);
+            }
+            break;
+        }
+    OstTraceFunctionExit0( CUPNPTMINFOELEMENT_CONSTRUCTL_EXIT );
+    }
+
+// ------------------------------------------------------------------------------------------
+// CUpnpTmInfoElement::~CUpnpTmInfoElement
+// Destructor
+// ------------------------------------------------------------------------------------------
+//
+CUpnpTmInfoElement::~CUpnpTmInfoElement()
+    {
+    OstTraceFunctionEntry0( CUPNPTMINFOELEMENT_CUPNPTMINFOELEMENT_ENTRY );
+    // Cleans up the arrays
+    for ( TInt i(0); i < iInfoElementNameArray.Count(); i++ )
+        {
+        iInfoElementNameArray[i].Close();    
+        }
+    for ( TInt i(0); i < iInfoElementValueArray.Count(); i++ )
+        {
+        iInfoElementValueArray[i].Close();    
+        }
+    iInfoElementNameArray.Close();
+    iInfoElementValueArray.Close(); 
+    delete iInfoTypeBuffer;
+    OstTraceFunctionExit0( CUPNPTMINFOELEMENT_CUPNPTMINFOELEMENT_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::AddTmInfoElementL
+// Method is used to add key-value pair
+// @param aName   Name of the key
+// @param aValue  value for the key
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmInfoElement::AddTmInfoElementL( const TDesC8& aName,
+                                                         const TDesC8& aValue )                                                                     
+    {
+    OstTraceFunctionEntry0( CUPNPTMINFOELEMENT_ADDTMINFOELEMENTL_ENTRY );
+    iElementName.CreateL(aName);
+    iElementValue.CreateL(aValue);
+    iInfoElementNameArray.AppendL(iElementName);
+    iInfoElementValueArray.AppendL(iElementValue);
+    OstTraceFunctionExit0( CUPNPTMINFOELEMENT_ADDTMINFOELEMENTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::GetTmInfoElement
+// Method is used to fetch the key-value pair for the index provided in the input.
+// @param aInfoElementName[out]   Name of the key
+// @param aInfoElementValue[out]  Value for the key
+// @param aIndex     Index of the array for which key-value pair is needed
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmInfoElement::GetTmInfoElementL( RBuf8& aInfoElementName, 
+                                           RBuf8& aInfoElementValue, TInt aIndex )const
+    {
+    OstTraceFunctionEntry0( CUPNPTMINFOELEMENT_GETTMINFOELEMENTLIST_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMINFOELEMENT_GETTMINFOELEMENTL, "CUpnpTmInfoElement::GetTmInfoElementL;aIndex=%d", aIndex );
+    if ( ( aIndex < KErrNone ) || ( aIndex >= iInfoElementNameArray.Count()) )
+        {
+        // Leaves in case of invalid array index
+        User::Leave(KErrArgument);
+        }
+    aInfoElementName.Close();
+    aInfoElementName.CreateL(iInfoElementNameArray[aIndex]); 
+    aInfoElementValue.Close();
+    aInfoElementValue.CreateL(iInfoElementValueArray[aIndex]);
+    OstTraceFunctionExit0( CUPNPTMINFOELEMENT_GETTMINFOELEMENTLIST_EXIT );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmserver.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,223 @@
+/**
+* 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: CUpnpTmServer class implementation.
+*
+*/
+
+//  Include Files  
+#include "upnptmserver.h"   
+#include "upnptmserverimpl.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmserverTraces.h"
+#endif
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServer::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C CUpnpTmServer* CUpnpTmServer::NewL( CUpnpTmServerDeviceInfo& aDeviceInfo,
+                                            MUpnpTmServerObserver& aUpnpTmServerObserver)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_NEWL_ENTRY );
+    CUpnpTmServer* self = new (ELeave) CUpnpTmServer();
+    CleanupStack::PushL(self);
+    self->ConstructL( aDeviceInfo, aUpnpTmServerObserver);
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMSERVER_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServer::CUpnpTmServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServer::CUpnpTmServer()
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServer::ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo, MUpnpTmServerObserver& aUpnpTmServerObserver)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_CONSTRUCTL_ENTRY );
+    iTmServerImpl = CUpnpTmServerImpl::NewL( aDeviceInfo, aUpnpTmServerObserver);
+    OstTraceFunctionExit0( CUPNPTMSERVER_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Default Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServer::~CUpnpTmServer()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_CUPNPTMSERVER_ENTRY );
+    delete iTmServerImpl;
+    OstTraceFunctionExit0( CUPNPTMSERVER_CUPNPTMSERVER_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used by Automotive Server to register its applications one by one.
+// @param aRemotableApp Pointer to Remotable app object. Ownership is transferred.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServer::RegisterAppL( CUpnpRemotableApp* aRemotableApp )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_REGISTERAPPL_ENTRY );
+    iTmServerImpl->RegisterAppL(aRemotableApp);
+    OstTraceFunctionExit0( CUPNPTMSERVER_REGISTERAPPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used by Automotive Server to register all the desired applications 
+// in one go.
+// @param aRemotableAppList Pointer Array of remotable app objects.
+//                          Ownership of all the objects is passed.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServer::RegisterAppsL(const RPointerArray<CUpnpRemotableApp>& aRemotableAppList)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_REGISTERAPPSL_ENTRY );
+    iTmServerImpl->RegisterAppsL(aRemotableAppList);
+    OstTraceFunctionExit0( CUPNPTMSERVER_REGISTERAPPSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used by Automotive Server to un-register its applications which have 
+// already been registeredone by one
+// @param aAppId App ID of the application
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpTmServer::UnRegisterApp( TUint aAppId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_UNREGISTERAPP_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVER_UNREGISTERAPP, "CUpnpTmServer::UnRegisterApp;aAppId=%u", aAppId ); 
+    return iTmServerImpl->UnRegisterApp( aAppId );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used to un-register multiple applications in one go.
+// @param aAppIdArray Array of app IDs
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C TInt CUpnpTmServer::UnRegisterApps( const RArray<TUint>& aAppIdArray )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_UNREGISTERAPPS_ENTRY );
+    return iTmServerImpl->UnRegisterApps( aAppIdArray );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method to set the XML signature of the registered apps.
+// @param aSignature XML formatted signature buffer
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServer::SetXmlSignatureL( const TDesC8& aSignature )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_SETXMLSIGNATUREL_ENTRY );
+    iTmServerImpl->SetXmlSignatureL( aSignature );   
+    OstTraceFunctionExit0( CUPNPTMSERVER_SETXMLSIGNATUREL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used by Automotive Server to start publishing the remote ui server 
+// device and its service
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServer::StartL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_STARTL_ENTRY );
+    iTmServerImpl->StartDeviceL();
+    OstTraceFunctionExit0( CUPNPTMSERVER_STARTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used by Automotive Server to stop publishing the remote ui server 
+// device and its service
+// -------------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServer::StopL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_STOPL_ENTRY );
+    iTmServerImpl->StopDeviceL();
+    OstTraceFunctionExit0( CUPNPTMSERVER_STOPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method to fetch the Remotable App object by passing the App ID of the same.
+// Method is invoked by the Automotive Server when it wishes to modify any of the
+// existing remotable app.
+// @param aAppId APP ID of the application for which caller wants the access.
+// @param aErr[out] Error code. KErrNone if app is found otherwise KErrNotFound
+// Returns reference to the remotable app object.
+// --------------------------------------------------------------------------------- 
+//
+EXPORT_C CUpnpRemotableApp& CUpnpTmServer::GetRemotableApp( TUint aAppId, TInt& aErr )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_REMOTABLEAPP_ENTRY );
+    OstTrace1( TRACE_NORMAL, DUP1_CUPNPTMSERVER_GETREMOTABLEAPP, "CUpnpTmServer::GetRemotableApp;aAppId =%d", aAppId  );
+    return iTmServerImpl->GetRemotableApp( aAppId, aErr );  
+    }
+
+// ---------------------------------------------------------------------------------
+// Method through which the notification of applications whose status 
+// has changed is sent across to the Car Kit through the Service 
+// @param aUpdatedAppIdList Array of app IDs which have undergone some 
+//                          kind of change[ added, delete or modified ]
+// ---------------------------------------------------------------------------------   
+//
+EXPORT_C void CUpnpTmServer::UpdateAppStatusL( const RArray<TUint>& aUpdatedAppIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_UPDATEAPPSTATUSL_ENTRY );
+    iTmServerImpl->UpdateAppStatusL( aUpdatedAppIdList );   
+    OstTraceFunctionExit0( CUPNPTMSERVER_UPDATEAPPSTATUSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method through which the notification of applications whose entries 
+// in the application list have  changed is sent across to the Car Kit 
+// through the Service 
+// @param aUpdatedAppIdList Array of app IDs which have undergone some 
+//                          kind of change[ added, delete or modified ]
+// ---------------------------------------------------------------------------------   
+//
+EXPORT_C void CUpnpTmServer::UpdateAppListL( const RArray<TUint>& aUpdatedAppIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_UPDATEAPPLISTL_ENTRY );
+    iTmServerImpl->UpdateAppListL( aUpdatedAppIdList );  
+    OstTraceFunctionExit0( CUPNPTMSERVER_UPDATEAPPLISTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// Method through which the notification of profileIDs which are not used
+// used by any Terminal Mode service hosted on the Terminal Mode device
+// is sent across to the Car Kit through the Service 
+// @param aUnusedProfileIdList Array of profile IDs which have undergone some 
+//                             kind of change
+// ---------------------------------------------------------------------------------   
+//
+EXPORT_C void CUpnpTmServer::UpdateUnusedProfileIdsL( const RArray<TUint>& aUnusedProfileIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVER_UPDATEUNUSEDPROFILEIDSL_ENTRY );
+    iTmServerImpl->UpdateUnusedProfileIdsL( aUnusedProfileIdList );   
+    OstTraceFunctionExit0( CUPNPTMSERVER_UPDATEUNUSEDPROFILEIDSL_EXIT );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmserverdescriptionprovider.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,185 @@
+/**
+* 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: CUpnpTmServerDescriptionProvider class implementation.
+*
+*/
+
+#include "upnptmserverdescriptionprovider.h"
+#include <utf.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmserverdescriptionproviderTraces.h"
+#endif
+
+
+_LIT(KPublic,   "public\\");
+_LIT(KIconPath, "icon");
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::NewL
+//
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDescriptionProvider* CUpnpTmServerDescriptionProvider::NewL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_NEWL_ENTRY );
+    CUpnpTmServerDescriptionProvider* self = new (ELeave) CUpnpTmServerDescriptionProvider();           
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self); 
+    OstTraceFunctionExit0( CUPNPTMSERVERDESCRIPTIONPROVIDER_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::CUpnpTmServerDescriptionProvider
+//
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDescriptionProvider::CUpnpTmServerDescriptionProvider()
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::~CUpnpTmServerDescriptionProvider
+//
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDescriptionProvider::~CUpnpTmServerDescriptionProvider()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_CUPNPTMSERVERDESCRIPTIONPROVIDER_ENTRY );
+    iFs.Close();
+    OstTraceFunctionExit0( CUPNPTMSERVERDESCRIPTIONPROVIDER_CUPNPTMSERVERDESCRIPTIONPROVIDER_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::ConstructL
+//
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDescriptionProvider::ConstructL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_CONSTRUCTL_ENTRY );
+    User::LeaveIfError( iFs.Connect() );        
+    OstTraceFunctionExit0( CUPNPTMSERVERDESCRIPTIONPROVIDER_CONSTRUCTL_EXIT );
+    }
+
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::OnDeviceDescription
+//
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerDescriptionProvider::OnDeviceDescription( 
+                                       CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONDEVICEDESCRIPTION_ENTRY );
+    return OnRequest( aRequest );
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::OnServiceDescription
+//
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerDescriptionProvider::OnServiceDescription( 
+                                        CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONSERVICEDESCRIPTION_ENTRY );
+    return OnRequest( aRequest );
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::OnIcon
+//
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerDescriptionProvider::OnIcon( CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONICON_ENTRY );
+    return OnRequest( aRequest );
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::GetFile
+//
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerDescriptionProvider::GetFile( const TDesC8& /*aUri*/, RFile& aFile )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_GETFILE_ENTRY );
+    return ( aFile.Open( iFs, iFilePath, EFileShareReadersOnly | EFileRead ));  
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::OnRequest
+//
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerDescriptionProvider::OnRequest( CUpnpDeviceDescriptionRequest& aRequest )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONREQUEST_ENTRY );
+    TPtrC8 fileName;
+    TInt error(KErrNone);
+    TPtrC8 urlPath = UpnpFileUtil::ExtractUrlPath( aRequest.Uri(), fileName, error );
+    if( error == KErrNone)
+        {    
+        TRAP( error, OnRequestL( urlPath,fileName ) );
+        }
+    OstTraceFunctionExit0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONREQUEST_EXIT );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------------
+//  CUpnpTmServerDescriptionProvider::OnRequestL
+//  @param aUrlPath   URL 
+//  @param aFileName  FileName 
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDescriptionProvider::OnRequestL( const TDesC8& aUrlPath, 
+                                                              const TDesC8& aFileName )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONREQUESTL_ENTRY );
+    // 8-bit to 16-bit conversion of URL path and file path
+    TBuf<UpnpString::KMaxFilenameLength> urlPath;  
+    urlPath.Copy(aUrlPath);
+    TBuf<UpnpString::KMaxFilenameLength> fileName;  
+    fileName.Copy(aFileName);
+    
+    // Fetches the private directory
+    User::LeaveIfError( iFs.PrivatePath( iFilePath ) );
+    iFilePath.Append(KPublic());
+    /** 
+     * Appends the filename to the file path.
+     * 1. In case of icon file, it first appends icon directory and then appends the filename.
+     * 2. In case of device and service xml files, it merely appends filename to the file path.
+     */
+    if ( urlPath.Find(KIconPath()) != KErrNotFound )
+        {
+        // The request is for icon file
+        iFilePath.Append(urlPath.Left(urlPath.Locate(KForwardSlash))); 
+        iFilePath.Append(UpnpString::KDoubleBackSlash16());    
+        iFilePath.Append(KIconPath());
+        }
+    else
+        {
+        iFilePath.Append(urlPath);   
+        }
+    iFilePath.Append(UpnpString::KDoubleBackSlash16());
+    // Appends filename to the file path.
+    iFilePath.Append(fileName);
+    OstTraceFunctionExit0( CUPNPTMSERVERDESCRIPTIONPROVIDER_ONREQUESTL_EXIT );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmserverdevice.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,180 @@
+/**
+* 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: CUpnpTmServerDevice class implementation.
+*
+*/
+
+// INCLUDE FILES
+#include "upnptmserverdevice.h"
+#include <upnpconnectionmanagernetworkeventprovider.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmserverdeviceTraces.h"
+#endif
+
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDevice* CUpnpTmServerDevice::NewL( CUpnpTmServerDeviceInfo& aDeviceInfo,
+                                                    CUpnpTmServerImpl& aTmServerImpl )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_NEWL_ENTRY );
+    CUpnpTmServerDevice* self = new( ELeave ) CUpnpTmServerDevice();
+    CleanupStack::PushL( self );
+    self->ConstructL( aDeviceInfo, aTmServerImpl );
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_NEWL_EXIT );
+    return self;
+    }
+
+// -------------------------------------------------------------------------------------
+// CUpnpTmServerDevice::CUpnpTmServerDevice
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDevice::CUpnpTmServerDevice():iIsStarted(EFalse) 
+    {
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDevice::ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo,
+                                              CUpnpTmServerImpl& aTmServerImpl )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_CONSTRUCTL_ENTRY );
+    iXmlParser = CUpnpTmServerDeviceXmlParser::NewL( aDeviceInfo );
+    iXmlParser->StartL();
+    iDescriptionProvider = CUpnpTmServerDescriptionProvider::NewL();
+    
+    iDescriptionStore = CUpnpDeviceDescriptionStore::NewL( iXmlParser->DevicePath() );
+    // creates device
+    iDevice = CUpnpDeviceImplementation::NewL( iXmlParser->DescriptionUri(), 
+                                               *iDescriptionStore, 
+                                               *iDescriptionProvider );
+    // Creates two services
+    iTmAppServerService = CUpnpTmAppServerService::NewL( *iDevice, iXmlParser->AppServerSrvPath(), aTmServerImpl );
+    iTmClientProfileService = CUpnpTmClientProfileService::NewL( *iDevice, iXmlParser->ClientProfileSrvPath(),
+                                                                                               aTmServerImpl );
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::~CUpnpTmServerDevice
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDevice::~CUpnpTmServerDevice()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_CUPNPTMSERVERDEVICE_ENTRY );
+    delete iTmAppServerService;
+    delete iTmClientProfileService;
+    delete iDevice;
+    delete iDescriptionStore;
+    delete iDescriptionProvider;
+    delete iXmlParser;
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_CUPNPTMSERVERDEVICE_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::StartTmServerDeviceL
+// Starts the Terminal Mode Server Device if not started.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDevice::StartTmServerDeviceL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_STARTTMSERVERDEVICEL_ENTRY );
+    if ( iIsStarted )
+        {  
+        // Device is already up and running
+        OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_STARTTMSERVERDEVICEL_EXIT );
+        return;
+        }
+    
+   if ( !iDevice )
+        {
+        // Leaves if the device object is not initialised
+        User::Leave(KErrNotReady);
+        }
+    // Starts TM Server Device
+    iDevice->StartL();
+    iIsStarted = ETrue;  
+    OstTraceFunctionExit0( DUP1_CUPNPTMSERVERDEVICE_STARTTMSERVERDEVICEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::StopTmServerDeviceL
+// Stops the Terminal Mode Server Device.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDevice::StopTmServerDeviceL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_STOPTMSERVERDEVICEL_ENTRY );
+    if ( iDevice )
+        {
+        iDevice->StopL();
+        }
+    iIsStarted = EFalse;  
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_STOPTMSERVERDEVICEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::AppStatusUpdateL
+// Notifies the client about the application status updates
+// @param aStatusEventBuffer buffer holding the update app status information
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDevice::AppStatusUpdateL( const TDesC8& aStatusEventBuffer )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_APPSTATUSUPDATEL_ENTRY );
+    iTmAppServerService->AppStatusUpdateEventL(aStatusEventBuffer);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_APPSTATUSUPDATEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::AppListUpdateL
+// Notifies the client about the application list updates
+// @param aListEventBuffer buffer holding the update app list information
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDevice::AppListUpdateL( const TDesC8& aListEventBuffer )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_APPLISTUPDATEL_ENTRY );
+    iTmAppServerService->AppListUpdateEventL(aListEventBuffer);   
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_APPLISTUPDATEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDevice::aUnusedProfileIdBuffer
+// Notifies the client about the application list updates
+// @param aUnusedProfileIdBuffer buffer holding the update app list information
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDevice::UnUsedProfileIdUpdateL( const TDesC8& aUnusedProfileIdBuffer )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICE_UNUSEDPROFILEIDUPDATEL_ENTRY );
+    iTmClientProfileService->UnUsedProfileIdEventL(aUnusedProfileIdBuffer);   
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICE_UNUSEDPROFILEIDUPDATEL_EXIT );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmserverdeviceinfo.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,134 @@
+/**
+* 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: CUpnpTmServerDeviceInfo class implementation.
+*
+*/
+
+//  Include Files  
+#include "upnptmserverdeviceinfo.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmserverdeviceinfoTraces.h"
+#endif
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::NewL
+// Two-phased constructor.
+// @param aIapId    IAP ID.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C CUpnpTmServerDeviceInfo* CUpnpTmServerDeviceInfo::NewL( TUint32 aIapId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_NEWL_ENTRY );
+    CUpnpTmServerDeviceInfo* self = new (ELeave) CUpnpTmServerDeviceInfo(  );  
+    CleanupStack::PushL(self);
+    self->ConstructL( aIapId );
+    CleanupStack::Pop(self);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_NEWL_EXIT );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::CUpnpTmServerDeviceInfo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDeviceInfo::CUpnpTmServerDeviceInfo( ):iDeviceInfo(NULL),
+    iBtAddr(NULL),iStartConnValue(EFalse)
+    {
+
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::ConstructL
+// Symbian 2nd phase constructor can leave.
+// @param aIapId    IAP ID. Leaves if the proper IAP ID is not set.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceInfo::ConstructL( TUint32 aIapId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_CONSTRUCTL_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERDEVICEINFO_CONSTRUCTL, "CUpnpTmServerDeviceInfo::ConstructL;aIapId=%d", aIapId );
+    
+    if ( aIapId <= KErrNone )
+        {
+        User::Leave( KErrArgument );  // Leaves in case of invalid IAP ID
+        }
+    iIapId = aIapId;   
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::~CUpnpTmServerDeviceInfo
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDeviceInfo::~CUpnpTmServerDeviceInfo()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_CUPNPTMSERVERDEVICEINFO_ENTRY );
+    delete iDeviceInfo;
+    delete iBtAddr;
+    iDeviceIconList.ResetAndDestroy();
+    iDeviceIconList.Close();
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_CUPNPTMSERVERDEVICEINFO_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::SetDeviceInfoL
+// Method is used to provide Nokia specific additional info about the device
+// @param aDeviceInfo    XML formatted buffer containg deviceInfo element.
+// -------------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServerDeviceInfo::SetDeviceInfoL( const TDesC8& aDeviceInfo )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_SETDEVICEINFOL_ENTRY );
+    delete iDeviceInfo;
+    iDeviceInfo = NULL;
+    iDeviceInfo = aDeviceInfo.AllocL();   
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_SETDEVICEINFOL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::SetBtAddressL
+// Method is used to set bluetooth MAC address of the device
+// @param aBtAddress   BT MAC address
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServerDeviceInfo::SetBtAddressL( const TDesC8& aBtAddress )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_SETBTADDRESSL_ENTRY );
+    delete iBtAddr;
+    iBtAddr = NULL;
+    iBtAddr = aBtAddress.AllocL();
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_SETBTADDRESSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::AddDeviceIconL
+// Method is used to provide device icon information.
+// @param aDeviceIcon   Pointer to the Terminal Mode Icon object.
+//                      Ownership of the object is passed.
+// ---------------------------------------------------------------------------------
+//
+EXPORT_C void CUpnpTmServerDeviceInfo::AddDeviceIconL( CUpnpTerminalModeIcon* aDeviceIcon )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEINFO_ADDDEVICEICONL_ENTRY );
+    iDeviceIconList.AppendL(aDeviceIcon);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEINFO_ADDDEVICEICONL_EXIT );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmserverdevicexmlparser.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,505 @@
+/**
+* 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: CUpnpTmServerDeviceXmlParser class implementation.
+*
+*/
+
+// System Includes
+#include <xml/parserfeature.h>
+#include <xml/taginfo.h>
+
+// User Includes
+#include "upnptmserverdevicexmlparser.h"
+#include "upnpterminalmodeicon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmserverdevicexmlparserTraces.h"
+#endif
+
+
+//Literals
+_LIT8(KTextXml,           "text/xml");
+_LIT8(KRootDeviceXmlLead, "<?xml version=\"1.0\" encoding=\"utf-8\"?><root xmlns=\"urn:schemas-upnp-org:device-1-0\"><specVersion><major>1</major><minor>0</minor></specVersion><device><deviceType>urn:schemas-upnp-org:device:TmServerDevice:1</deviceType><friendlyName>S60</friendlyName><manufacturer /><manufacturerURL>http://www.nokia.com</manufacturerURL><modelName /><serialNumber /><UDN /><X_connectivity><bluetooth><btAddr /><startConnection /></bluetooth></X_connectivity>");
+_LIT8(KRootDeviceXmlTrail,"<serviceList><service><serviceType>urn:schemas-upnp-org:service:TmApplicationServer:1</serviceType><serviceId>urn:upnp-org:serviceId:TmApplicationServer1</serviceId><SCPDURL>/tmserverdevice1/tmapplicationserver1.xml</SCPDURL><controlURL>/tmserverdevice1/tmapplicationserver1/control</controlURL><eventSubURL>/tmserverdevice1/tmapplicationserver1/eventing</eventSubURL></service><service><serviceType>urn:schemas-upnp-org:service:TmClientProfile:1</serviceType>"
+    "<serviceId>urn:upnp-org:serviceId:TmClientProfile1</serviceId><SCPDURL>/tmserverdevice1/tmclientprofile1.xml</SCPDURL><controlURL>/tmserverdevice1/tmclientprofile1/control</controlURL><eventSubURL>/tmserverdevice1/tmclientprofile1/eventing</eventSubURL></service></serviceList></device></root>");
+_LIT8(KAppServerSrvXml,   "<?xml version=\"1.0\" encoding=\"utf-8\"?><scpd xmlns=\"urn:schemas-upnp-org:service-1-0\"><specVersion><major>1</major> <minor>0</minor> </specVersion><actionList><action><name>GetApplicationList</name><argumentList><argument><name>AppListingFilter</name><direction>in</direction> <relatedStateVariable>A_ARG_TYPE_String</relatedStateVariable> </argument><argument><name>ProfileID</name><direction>in</direction> <relatedStateVariable>A_ARG_TYPE_ProfileID</relatedStateVariable> "
+    "</argument><argument><name>AppListing</name><direction>out</direction><relatedStateVariable>A_ARG_TYPE_AppList</relatedStateVariable></argument></argumentList></action><action><name>LaunchApplication</name><argumentList><argument><name>AppID</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_AppID</relatedStateVariable></argument><argument><name>ProfileID</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_ProfileID</relatedStateVariable></argument><argument><name>AppURI</name>"
+    "<direction>out</direction><relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable></argument></argumentList></action><action><name>TerminateApplication</name><argumentList><argument><name>AppID</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_AppID</relatedStateVariable></argument><argument><name>ProfileID</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_ProfileID</relatedStateVariable></argument><argument><name>TerminationResult</name><direction>out</direction>"
+    "<relatedStateVariable>A_ARG_TYPE_Bool</relatedStateVariable></argument></argumentList></action><action><name>GetApplicationStatus</name><argumentList><argument><name>AppID</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_AppID</relatedStateVariable></argument><argument><name>AppStatus</name><direction>out</direction><relatedStateVariable>A_ARG_TYPE_AppStatus</relatedStateVariable></argument></argumentList></action></actionList><serviceStateTable><stateVariable sendEvents=\"yes\">"
+    "<name>AppStatusUpdate</name> <dataType>string</dataType></stateVariable><stateVariable sendEvents=\"yes\"><name>AppListUpdate</name> <dataType>string</dataType></stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_AppStatus</name> <dataType>string</dataType> </stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_AppList</name><dataType>string</dataType></stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_AppID</name><dataType>string</dataType></stateVariable>"
+    "<stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_ProfileID</name><dataType>ui4</dataType><defaultValue>0</defaultValue></stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_URI</name> <dataType>uri</dataType> </stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_String</name><dataType>string</dataType></stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_Bool</name><dataType>string</dataType><defaultValue>false</defaultValue><allowedValueList><allowedValue>false</allowedValue>"
+    "<allowedValue>true</allowedValue></allowedValueList></stateVariable></serviceStateTable></scpd>");
+_LIT8(KClientProfSrvXml,  "<?xml version=\"1.0\" encoding=\"utf-8\"?><scpd xmlns=\"urn:schemas-upnp-org:service-1-0\"><specVersion><major>1</major> <minor>0</minor> </specVersion><actionList><action><name>GetMaxNumProfiles</name><argumentList><argument><name>numProfilesAllowed</name><direction>out</direction> <relatedStateVariable>MaxNumProfiles</relatedStateVariable> </argument></argumentList></action><action><name>SetClientProfile</name><argumentList><argument><name>profileID</name><direction>in</direction>"
+    "<relatedStateVariable>A_ARG_TYPE_ProfileID</relatedStateVariable></argument><argument><name>clientProfile</name><direction>in</direction><relatedStateVariable>A_ARG_TYPE_ClientProfile</relatedStateVariable></argument><argument><name>resultProfile</name><direction>out</direction><relatedStateVariable>A_ARG_TYPE_ClientProfile</relatedStateVariable></argument></argumentList></action><action><name>GetClientProfile</name><argumentList><argument><name>profileID</name><direction>in</direction>"
+    "<relatedStateVariable>A_ARG_TYPE_ProfileID</relatedStateVariable></argument><argument><name>clientProfile</name><direction>out</direction><relatedStateVariable>A_ARG_TYPE_ClientProfile</relatedStateVariable></argument></argumentList></action></actionList><serviceStateTable><stateVariable sendEvents=\"yes\"><name>UnusedProfileIDs</name> <dataType>string</dataType></stateVariable><stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_ClientProfile</name> <dataType>string</dataType></stateVariable>"
+    "<stateVariable sendEvents=\"no\"><name>A_ARG_TYPE_ProfileID</name><dataType>ui4</dataType><defaultValue>0</defaultValue></stateVariable><stateVariable sendEvents=\"no\"><name>MaxNumProfiles</name> <dataType>ui2</dataType> <defaultValue>1</defaultValue> </stateVariable> </serviceStateTable></scpd>");
+_LIT8(KStartLine,         "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+_LIT8(KRootAttrb,         " xmlns=\"urn:schemas-upnp-org:device-1-0\"");
+_LIT8(KScpdUrl,           "/tmserverdevice1/");
+_LIT8(KUpnpDeviceRoot,    "root" );
+_LIT8(KStartIconList,     "<iconList>" );
+_LIT8(KEndIconList,       "</iconList>" );
+_LIT8(KStartIcon,         "<icon>" );
+_LIT8(KEndIcon,           "</icon>" );
+_LIT8(KStartMimeType,     "<mimetype>" );
+_LIT8(KEndMimeType,       "</mimetype>" );
+_LIT8(KStartWidth,        "<width>" );
+_LIT8(KEndWidth,          "</width>" );
+_LIT8(KStartHeight,       "<height>" );
+_LIT8(KEndHeight,         "</height>" );
+_LIT8(KStartDepth,        "<depth>" );
+_LIT8(KEndDepth,          "</depth>" );
+_LIT8(KStartUrl,          "<url>" );
+_LIT8(KEndUrl,            "</url>" );
+_LIT8(KPhoneManufacturer, "manufacturer" );
+_LIT8(KPhoneModel,        "modelName" );
+_LIT8(KPhoneSerialNumber, "serialNumber" );
+_LIT8(KBtAddress,         "btAddr" );
+_LIT8(KStartConnection,   "startConnection" );
+_LIT8(KIconPath,          "icon/");
+_LIT8(KConnTrue,          "true");
+_LIT8(KConnFalse,         "false");
+_LIT(KPublicDevicePath,   "public\\TmServerDevice1\\");
+_LIT(KDeviceName,         "TmServerDevice1.xml");
+_LIT(KAppServerSrvName,   "TmApplicationServer1.xml");
+_LIT(KClientProfSrvName,  "TmClientProfile1.xml");
+_LIT(KIconDirectory,      "icon\\");
+
+
+// ============================ MEMBER FUNCTIONS ===================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDeviceXmlParser* CUpnpTmServerDeviceXmlParser::NewL( CUpnpTmServerDeviceInfo& aDeviceInfo )
+	{
+	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_NEWL_ENTRY );
+	CUpnpTmServerDeviceXmlParser* self = new (ELeave) CUpnpTmServerDeviceXmlParser( aDeviceInfo );
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_NEWL_EXIT );
+	return self;	
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::~CUpnpTmServerDeviceXmlParser
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDeviceXmlParser::~CUpnpTmServerDeviceXmlParser()	
+	{
+	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_CUPNPTMSERVERDEVICEXMLPARSER_ENTRY );
+	DeleteDirectory();
+	iPhone.Close();
+	iEtelSrv.Close();
+	delete iParser;
+	iAppServerSrvDescription.Close();
+	iClientProfSrvDescription.Close();
+	iReadBuf.Close();
+	iDeviceDescription.Close();
+	iDescFilePath.Close();
+	iClientProfSrvFilePath.Close();
+	iAppServerSrvFilePath.Close();
+	iDescriptionUri.Close();
+	iFs.Close();
+	iDeviceDir.Close();
+	iIconDirectory.Close();
+	delete iFileMan;
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_CUPNPTMSERVERDEVICEXMLPARSER_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::DeleteDirectory
+// Deletes device and service description files and device icon files related to  
+// Terminal Mode Service located in the private directory.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceXmlParser::DeleteDirectory()   
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_DELETEDIRECTORY_ENTRY );
+    iFs.Delete(iDescFilePath);
+    iFs.Delete(iAppServerSrvFilePath);
+    iFs.Delete(iClientProfSrvFilePath); 
+    iFileMan->RmDir(iIconDirectory);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_DELETEDIRECTORY_EXIT );
+    }
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::CUpnpTmServerDeviceXmlParser
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerDeviceXmlParser::CUpnpTmServerDeviceXmlParser( CUpnpTmServerDeviceInfo& aDeviceInfo )
+    :iDeviceInfo(aDeviceInfo)
+	{		
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceXmlParser::ConstructL( )
+	{
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_CONSTRUCTL_ENTRY );
+    User::LeaveIfError(iEtelSrv.Connect());
+    User::LeaveIfError(iEtelSrv.LoadPhoneModule( KMmTsyModuleName ));
+    User::LeaveIfError(iPhone.Open( iEtelSrv, KMmTsyPhoneName ));
+    TRequestStatus status;
+    iPhone.GetPhoneId(status, iPhoneId); 
+    User::WaitForRequest(status);
+	User::LeaveIfError(iFs.Connect());
+    iAppServerSrvDescription.CreateL( KAppServerSrvXml() );
+    iClientProfSrvDescription.CreateL( KClientProfSrvXml() );
+	iParser = CParser::NewL(KTextXml(), *this);
+	iParser->EnableFeature(ESendFullContentInOneChunk);
+	iReadBuf.CreateMaxL(KBufSize);
+	iDeviceDescription.CreateMaxL(KBufSize);
+	iDeviceDescription.SetLength(KErrNone);
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_CONSTRUCTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnStartDocumentL
+// Called when parser hits the start of the document
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceXmlParser::OnStartDocumentL(const RDocumentParameters& /*aDocParam*/,
+                                                                             TInt aErrorCode )
+	{
+	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTDOCUMENTL_ENTRY );
+	User::LeaveIfError(aErrorCode);
+    
+    TBuf<KMaxBufLength> tmpBuf(iDeviceDir);
+    tmpBuf.Append(KDeviceName());
+    iDescFilePath.CreateL(tmpBuf);
+    tmpBuf.Zero();
+    
+    // Create TmAppServer service xml
+    tmpBuf.Copy(iDeviceDir);
+    tmpBuf.Append(KAppServerSrvName());
+    RFile appServerSrvFile;
+    CleanupClosePushL(appServerSrvFile);
+    TInt err(KErrNone);
+    err = appServerSrvFile.Create(iFs, tmpBuf, EFileWrite);
+    if ( err == KErrAlreadyExists )
+        {
+        User::LeaveIfError(appServerSrvFile.Open(iFs, tmpBuf, EFileWrite));
+        }
+    else
+        {
+        User::LeaveIfError(err);
+        }
+    User::LeaveIfError(appServerSrvFile.Write(iAppServerSrvDescription));
+    CleanupStack::PopAndDestroy( &appServerSrvFile );
+    iAppServerSrvFilePath.CreateL(tmpBuf);
+    tmpBuf.Zero();
+    
+    // Create TmClientProfile service xml
+    tmpBuf.Copy(iDeviceDir);
+    tmpBuf.Append(KClientProfSrvName());
+    RFile clientProfSrvFile;
+    CleanupClosePushL(clientProfSrvFile);
+    err = clientProfSrvFile.Create(iFs, tmpBuf, EFileWrite);
+    if ( err == KErrAlreadyExists )
+        {
+        User::LeaveIfError(clientProfSrvFile.Open(iFs, tmpBuf, EFileWrite));
+        }
+    else
+        {
+        User::LeaveIfError(err);
+        }
+    User::LeaveIfError(clientProfSrvFile.Write(iClientProfSrvDescription));
+    CleanupStack::PopAndDestroy( &clientProfSrvFile );
+    iClientProfSrvFilePath.CreateL(tmpBuf);
+    
+    iDeviceDescription.Append(KStartLine());
+    iDescriptionUri.CreateMaxL(UpnpString::KDefaultStringLength);
+    iDescriptionUri.SetLength(KErrNone);
+    iDescriptionUri.Append(KScpdUrl());
+    iDescriptionUri.Append(KDeviceName());
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTDOCUMENTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnEndDocumentL
+// Called when parser hits the end of the document
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceXmlParser::OnEndDocumentL(TInt aErrorCode)
+	{
+	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDDOCUMENTL_ENTRY );
+	User::LeaveIfError(aErrorCode);
+	
+	RFile deviceFile;
+	CleanupClosePushL(deviceFile);
+	TInt err = deviceFile.Create(iFs, iDescFilePath, EFileWrite);
+	OstTrace1( TRACE_NORMAL, CUPNPTMSERVERDEVICEXMLPARSER_ONENDDOCUMENTL, "CUpnpTmServerDeviceXmlParser::OnEndDocumentL;err=%d", err );
+    if ( err == KErrAlreadyExists )
+        {
+        User::LeaveIfError(deviceFile.Open(iFs, iDescFilePath, EFileWrite));
+        }
+    else
+        {
+        User::LeaveIfError(err);
+        }
+	User::LeaveIfError(deviceFile.Write(iDeviceDescription));
+	CleanupStack::PopAndDestroy(&deviceFile);
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDDOCUMENTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnStartElementL
+// Called when parser hits the opening tag
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceXmlParser::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& /*aAttributes*/, TInt aErrorCode)
+	{
+	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTELEMENTL_ENTRY );
+	User::LeaveIfError(aErrorCode);
+
+	iDeviceDescription.Append(UpnpCD::KKorp);
+	iDeviceDescription.Append(aElement.LocalName().DesC());
+	
+    if(aElement.LocalName().DesC().Compare(KUpnpDeviceRoot) == 0)
+        {
+        iDeviceDescription.Append(KRootAttrb());    
+        }       
+    iDeviceDescription.Append(UpnpCD::KProk);
+
+    if(aElement.LocalName().DesC().Compare(KPhoneManufacturer) == 0)
+        {
+        iDeviceDescription.Append(iPhoneId.iManufacturer);   
+        }
+	else if(aElement.LocalName().DesC().Compare(KPhoneModel) == 0)
+        {
+        iDeviceDescription.Append(iPhoneId.iModel);   
+        }
+	else if(aElement.LocalName().DesC().Compare(KPhoneSerialNumber) == 0)
+        {
+        iDeviceDescription.Append(iPhoneId.iSerialNumber);   
+        }
+    else if(aElement.LocalName().DesC().Compare(KBtAddress) == 0)
+        {
+        iDeviceDescription.Append(iDeviceInfo.BtAddress());   
+        }
+    else if(aElement.LocalName().DesC().Compare(KStartConnection) == 0)
+        {
+        if ( iDeviceInfo.StartConn() )
+            {
+            iDeviceDescription.Append(KConnTrue);    
+            }
+        else
+            {
+            iDeviceDescription.Append(KConnFalse);    
+            }       
+        }
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTELEMENTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnEndElementL
+// Called when parser hits the closing tag
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerDeviceXmlParser::OnEndElementL( const RTagInfo& aElement, TInt aErrorCode )
+	{
+	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDELEMENTL_ENTRY );
+	User::LeaveIfError(aErrorCode);
+	
+	iDeviceDescription.Append( UpnpCD::KKorp );
+	iDeviceDescription.Append( UpnpString::KSlash );
+	iDeviceDescription.Append( aElement.LocalName().DesC() );
+	iDeviceDescription.Append( UpnpCD::KProk );
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDELEMENTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnContentL
+// Provides the content/value of the element/tag
+// ---------------------------------------------------------------------------------
+//	
+void CUpnpTmServerDeviceXmlParser::OnContentL( const TDesC8& aBytes, TInt aErrorCode )
+	{
+	User::LeaveIfError(aErrorCode);
+	iDeviceDescription.Append(aBytes);
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::StartL
+// Method which inputs xml formatted buffer content to the XML Parser 
+// and invokes parsing
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpTmServerDeviceXmlParser::StartL()
+	{
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_STARTL_ENTRY );
+    TDriveNumber drive = RFs::GetSystemDrive();   //Find system's drive
+    TBuf<UpnpString::KMaxFilenameLength> privatePath;  
+    TInt err = iFs.PrivatePath(privatePath); //Find the application's private path
+    // a) If the Private Path is not found (for whatever reasons),
+    //      Create a private path in the System Drive
+    if( err == KErrNotFound )
+        {
+        User::LeaveIfError( iFs.CreatePrivatePath(drive) );
+        }
+    // b) If Private Path is found but is a read-only or non-persistent drive
+    //      Create a private path in the system drive else use it
+    else if( err == KErrNone )
+        {
+        TDriveInfo driveInfo;
+        User::LeaveIfError( iFs.Drive(driveInfo));
+        TUint driveAttr = driveInfo.iDriveAtt;
+        if ( driveAttr == KDriveAttRom )
+            {
+            User::LeaveIfError( iFs.CreatePrivatePath(drive) );
+            }
+        }
+    else
+        {
+        OstTrace1( TRACE_ERROR, CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );     
+        User::Leave(err);
+        }
+    privatePath.Append(KPublicDevicePath());
+    err = iFs.MkDirAll(privatePath);
+    if( err && err != KErrAlreadyExists )
+        {
+        OstTrace1( TRACE_ERROR, DUP1_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
+        User::LeaveIfError(err);
+        }
+    iDeviceDir.CreateL(privatePath);
+    RBuf8 rootDeviceBuf;
+    CleanupClosePushL(rootDeviceBuf);
+    rootDeviceBuf.CreateL(KBufSize);
+    rootDeviceBuf.Append(KRootDeviceXmlLead());
+    // Appends the device icon list to the device xml buffer
+    const RPointerArray<CUpnpTerminalModeIcon>& deviceList = iDeviceInfo.DeviceIconList();
+    TInt iconCount = deviceList.Count();
+    if ( iconCount > KErrNone )
+        {
+        privatePath.Append(KIconDirectory());
+        err = iFs.MkDir(privatePath);  // Creates icon directory 
+        if( err && err != KErrAlreadyExists )
+            {
+            OstTrace1( TRACE_ERROR, DUP2_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
+            User::LeaveIfError(err);
+            }
+        iIconDirectory.CreateL(privatePath);
+        OstTrace1( TRACE_ERROR, DUP3_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;iconCount=%d", iconCount );
+        rootDeviceBuf.Append(KStartIconList);
+        for ( TInt i(0); i < iconCount; i++ )
+            {
+            rootDeviceBuf.Append(KStartIcon);
+            rootDeviceBuf.Append(KStartMimeType);
+            rootDeviceBuf.Append(deviceList[i]->MimeType());
+            rootDeviceBuf.Append(KEndMimeType);
+            rootDeviceBuf.Append(KStartWidth);
+            rootDeviceBuf.AppendNum(deviceList[i]->Width());
+            rootDeviceBuf.Append(KEndWidth);
+            rootDeviceBuf.Append(KStartHeight);
+            rootDeviceBuf.AppendNum(deviceList[i]->Height());
+            rootDeviceBuf.Append(KEndHeight);
+            rootDeviceBuf.Append(KStartDepth);
+            rootDeviceBuf.AppendNum(deviceList[i]->Depth());
+            rootDeviceBuf.Append(KEndDepth);
+            rootDeviceBuf.Append(KStartUrl);
+            
+            TBuf8<KMaxPath> iconBuf;
+            const TDesC& fileName = deviceList[i]->IconFilename();
+            iconBuf.Copy(fileName);
+            TBuf8<UpnpString::KDefaultStringLength> iconRelativeUrl(KScpdUrl());
+            // Extracts the actual input filepath and creates the relative url for the icon
+            // to be provided in the device xml file
+            iconRelativeUrl.Append(KIconPath());
+            // Extracts only filename and appends the same to url
+            iconRelativeUrl.Append(iconBuf.Mid((iconBuf.LocateReverse(KDirectorySeparator))+1));
+            rootDeviceBuf.Append(iconRelativeUrl);
+            delete iFileMan;
+            iFileMan = NULL;
+            iFileMan = CFileMan::NewL(iFs) ;
+            // copies icon files to the private device directory
+            User::LeaveIfError(iFileMan->Copy(fileName,iIconDirectory));  
+            rootDeviceBuf.Append(KEndUrl);
+            rootDeviceBuf.Append(KEndIcon);
+            }
+        rootDeviceBuf.Append(KEndIconList);
+        }
+    rootDeviceBuf.Append( iDeviceInfo.DeviceInfo());
+    rootDeviceBuf.Append( KRootDeviceXmlTrail() );
+       
+	ParseL(*iParser, rootDeviceBuf );
+	CleanupStack::PopAndDestroy(&rootDeviceBuf);
+
+	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_STARTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnStartPrefixMappingL
+// ---------------------------------------------------------------------------------
+//  
+void CUpnpTmServerDeviceXmlParser::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTPREFIXMAPPINGL_ENTRY );
+    User::LeaveIfError(aErrorCode);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTPREFIXMAPPINGL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnEndPrefixMappingL
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpTmServerDeviceXmlParser::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDPREFIXMAPPINGL_ENTRY );
+    User::LeaveIfError(aErrorCode);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDPREFIXMAPPINGL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnIgnorableWhiteSpaceL
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpTmServerDeviceXmlParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONIGNORABLEWHITESPACEL_ENTRY );
+    User::LeaveIfError(aErrorCode);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONIGNORABLEWHITESPACEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnSkippedEntityL
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpTmServerDeviceXmlParser::OnSkippedEntityL(const RString& /*aName*/, TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONSKIPPEDENTITYL_ENTRY );
+    User::LeaveIfError(aErrorCode);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONSKIPPEDENTITYL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceXmlParser::OnProcessingInstructionL
+// ---------------------------------------------------------------------------------
+// 
+void CUpnpTmServerDeviceXmlParser::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode)
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONPROCESSINGINSTRUCTIONL_ENTRY );
+    User::LeaveIfError(aErrorCode);
+    OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONPROCESSINGINSTRUCTIONL_EXIT );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/src/upnptmserverimpl.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,1055 @@
+/**
+* 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: CUpnpTmServerImpl class implementation.
+*
+*/
+
+// Includes
+#include "upnptmserverimpl.h"
+#include "upnpiconfileservetransaction.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "upnptmserverimplTraces.h"
+#endif
+
+
+//Literals
+_LIT8(KAppListStart,             "&lt;appList&gt;");
+_LIT8(KAppListEnd,               "&lt;/appList&gt;");
+_LIT8(KAppIdStart,               "&lt;appID&gt;");
+_LIT8(KAppIdEnd,                 "&lt;/appID&gt;");
+_LIT8(KNameStart,                "&lt;name&gt;");
+_LIT8(KNameEnd,                  "&lt;/name&gt;");
+_LIT8(KIconStart,                "&lt;icon&gt;");
+_LIT8(KIconEnd,                  "&lt;/icon&gt;");
+_LIT8(KMimeTypeStart,            "&lt;mimetype&gt;");
+_LIT8(KMimeTypeEnd,              "&lt;/mimetype&gt;");
+_LIT8(KWidthStart,               "&lt;width&gt;");
+_LIT8(KWidthEnd,                 "&lt;/width&gt;");
+_LIT8(KHeightStart,              "&lt;height&gt;");
+_LIT8(KHeightEnd,                "&lt;/height&gt;");
+_LIT8(KDepthStart,               "&lt;depth&gt;");
+_LIT8(KDepthEnd,                 "&lt;/depth&gt;");
+_LIT8(KUrlStart,                 "&lt;url&gt;");
+_LIT8(KUrlEnd,                   "&lt;/url&gt;");
+_LIT8(KAllowedProfileIdsStart,   "&lt;allowedProfileIDs&gt;");
+_LIT8(KAllowedProfileIdsEnd,     "&lt;/allowedProfileIDs&gt;");
+_LIT8(KResourceStatusStart,      "&lt;resourceStatus&gt;");
+_LIT8(KResourceStatusEnd,        "&lt;/resourceStatus&gt;");
+_LIT8(KAppStatusListStart,       "&lt;appStatusList&gt;");
+_LIT8(KAppStatusListEnd,         "&lt;/appStatusList&gt;");
+_LIT8(KAppStatusStart,           "&lt;appStatus&gt;");
+_LIT8(KAppStatusEnd,             "&lt;/appStatus&gt;");
+_LIT8(KStatusStart,              "&lt;status&gt;");
+_LIT8(KStatusEnd,                "&lt;/status&gt;");
+_LIT8(KProfileIdStart,           "&lt;profileID&gt;");
+_LIT8(KProfileIdEnd,             "&lt;/profileID&gt;");
+_LIT8(KStatusTypeStart,          "&lt;statusType&gt;");
+_LIT8(KStatusTypeEnd,            "&lt;/statusType&gt;");
+_LIT8(KStartTagOpenBracket,      "&lt;");
+_LIT8(KEndTagOpenBracket,        "&lt;/");
+_LIT8(KCloseBracket,             "&gt;");
+
+
+// ================= MEMBER FUNCTIONS ==============================================
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerImpl* CUpnpTmServerImpl::NewL( CUpnpTmServerDeviceInfo& aDeviceInfo,
+                                           MUpnpTmServerObserver& aTmServerObserver)
+    {
+    CUpnpTmServerImpl* self = new (ELeave) CUpnpTmServerImpl( aTmServerObserver );   
+    CleanupStack::PushL(self);
+    self->ConstructL( aDeviceInfo );
+    CleanupStack::Pop(self);
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::CUpnpTmServerImpl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerImpl::CUpnpTmServerImpl( MUpnpTmServerObserver& aTmServerObserver )
+      :iTmServerObserver(aTmServerObserver)
+     {
+
+     }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CONSTRUCTL_ENTRY );
+    iIapSetting = CUpnpSettings::NewL( KCRUidUPnPStack );
+    /**
+     *  Retrieve the IAP ID which has been set by DLNA and store it so that 
+     *  it can be reverted back to the same when Automotive Server has stopped 
+     *  making use of TM Service.
+     */
+    iIapId = CUpnpSettings::GetIapL(); 
+    //Fetch the IAP ID set by the Automotive Server
+    TInt iapId = aDeviceInfo.IapId();
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_CONSTRUCTL, "CUpnpTmServerImpl::ConstructL;iapId=%d", iapId );
+    // writes the iap id to the cenrep
+    User::LeaveIfError( iIapSetting->Set( CUpnpSettings::KUPnPStackIapId, iapId ) ); 
+    iTmServerDevice = CUpnpTmServerDevice::NewL( aDeviceInfo, *this );
+    iAppStore = CUpnpRemotableAppStore::NewL();
+    iIconMapping = CUpnpTmIconMapping::NewL();
+    User::LeaveIfError( iIconFileSession.Connect() );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CONSTRUCTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::~CUpnpTmServerImpl
+// Destructor
+// ---------------------------------------------------------------------------------
+//
+CUpnpTmServerImpl::~CUpnpTmServerImpl()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CUPNPTMSERVERIMPL_ENTRY );
+    //Restore the IAP ID for DLNA use
+    RestoreIap();
+    delete iIapSetting;
+    delete iFilteredAppList;
+    iIconFileSession.Close();
+    delete iAppStore;
+    delete iIconMapping;
+    iXmSignature.Close();
+    iResponseBuf.Close();
+    delete iTmServerDevice;
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CUPNPTMSERVERIMPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::RestoreIap
+// Method is used to restore IAP ID which has been previously retreived so that
+// DLNA continues to make use of it.
+// This method is mainly provided to avoid codescanner tool error.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::RestoreIap()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_RESTOREIAP_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_RESTOREIAP, "CUpnpTmServerImpl::RestoreIap;iIapId=%d", iIapId );
+    iIapSetting->Set( CUpnpSettings::KUPnPStackIapId, iIapId );    
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_RESTOREIAP_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GetApplicationListL
+// Method to create soap repsonse for GetApplicationList action.
+// It generates a list of applications, which can be launched and terminated remotely.
+// @param aAppListFilter Application Listing Filter. This is an optional parameter 
+//                     used by the UPnP Control Point to limit the AppListing value to 
+//                               those applications which meet the filter parameters.
+// @param aProfileId  ProfileID of client profile whose parameter settings will be 
+//                    applied for generating the application list
+// @param aErr[out]   TerminalMode error code
+// @return Returns soap response buffer 
+// ---------------------------------------------------------------------------------
+//
+const TDesC8& CUpnpTmServerImpl::GetApplicationListL( const TDesC8& aAppListFilter,
+                                     TUint aProfileId, TTerminalModeErrorCode& aErr )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GETAPPLICATIONLISTL_ENTRY );
+    iResponseBuf.Close();
+    iResponseBuf.CreateL(KActionBufferLength);
+    aErr = iTmServerObserver.OnGetApplicationList( aProfileId );  
+    if ( aErr == ETerminalModeSuccess )
+        {
+        // Check for availability of AppListingFilter input argument in the soap action
+        TInt filterStringFound = aAppListFilter.Find(Keq);
+        if ( filterStringFound != KErrNotFound )
+            {
+            delete iFilteredAppList;
+            iFilteredAppList = NULL;
+            
+            // Constructs a filter object and parses the input filter string
+            iFilteredAppList = CUpnpTmFilteredAppList::NewL(*this);
+            iFilteredAppList->ParseAppFilterStringL( aAppListFilter, aErr );
+            }
+        if ( aErr == ETerminalModeSuccess )
+            {
+            iProfileId = aProfileId; // Stored for generating app icon path in the soap response
+            AppendDataL(KAppListStart);
+            for ( TInt i(0) ; i < iAppStore->AppIdArray().Count(); i++)
+                 {
+                 // There can be 2 conditions assoicated with this
+                 // 1.  AppListingFilter is "*"
+                 // 2.  AppListingFilter has some filter string set
+                 const RArray<TUint>& profileIdList = iAppStore->FetchRemotableApp(i).AllowedProfileIdList();
+                 if ( ( profileIdList.Find(aProfileId) != KErrNotFound ) ||
+                                                    ( profileIdList.Count() == KErrNone ))
+                     {
+                    
+                     // If the provided profileID is allowed profileID for the app
+                     if (  filterStringFound == KErrNotFound )                 
+                         {
+                         // Constructs a non-filtered soap response
+                         ConstructActionResponseBufferL(i);             
+                         }   
+                     else                            
+                         {  
+                         // Constructs a filtered soap response
+                         iFilteredAppList->ConstructFilteredGetAppListResponseL(i);
+                         }
+                     }
+                 }
+            if ( ( filterStringFound == KErrNotFound ) || ( (iFilteredAppList->SignatureElement()).Length() != KErrNone ))
+                {
+                // Append the xml signature value to the response buffer if
+                // 1. Filter string contains the signature element
+                // 2. Filter value is '*'
+                AppendDataL(XmlSignature());
+                }
+            AppendDataL(KAppListEnd);        
+            }
+        }
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_GETAPPLICATIONLISTL_EXIT );
+    return iResponseBuf;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::LaunchApp
+// Method to create soap repsonse for LaunchApp action
+// @param aAppId App ID of the application to be launched remotely
+// @param aProfileId  ProfileID of client profile 
+// @param aUrl[out] URI of the remote application where it is running
+// @return Returns Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+TTerminalModeErrorCode CUpnpTmServerImpl::LaunchApp( TUint aAppId, TUint aProfileId, 
+                                                                       RBuf8& aUrl )    
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_LAUNCHAPP_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_LAUNCHAPP, "CUpnpTmServerImpl::LaunchApp;aAppId=%d", aAppId );
+    
+    TTerminalModeErrorCode err = AuthorizeApp(aAppId);
+    if ( err == ETerminalModeSuccess )
+        {
+        // Launching of the app succeeded
+        err = iTmServerObserver.OnLaunchApp( aAppId,aUrl,aProfileId ); 
+        }
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_LAUNCHAPP_EXIT );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::TerminateApp
+// Method to create soap repsonse for TerminateApp action
+// @param aAppId App ID of the application to be terminated
+// @param aProfileId  ProfileID of client profile 
+// @return Returns Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+TTerminalModeErrorCode CUpnpTmServerImpl::TerminateApp( TUint aAppId, TUint aProfileId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_TERMINATEAPP_ENTRY );
+    TTerminalModeErrorCode err = AuthorizeApp(aAppId);
+    if ( err == ETerminalModeSuccess )
+        {
+        // Termination of the app succeeded
+        err = iTmServerObserver.OnTerminateApp( aAppId, aProfileId );
+        } 
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_TERMINATEAPP, "CUpnpTmServerImpl::TerminateApp;err=%d", err );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_TERMINATEAPP_EXIT );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GetAppStatusL
+// Method to create soap repsonse for GetAppStatus action
+// @param aAppIdBuffer Buffer containing the appID or the wildcard character
+// @param aAppStatusResponse[out] soap response buffer 
+// @param aErr[out]  Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::GetAppStatusL( const TDesC8& aAppIdBuffer,RBuf8& aAppStatusResponse,
+                                                              TTerminalModeErrorCode& aErr )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GETAPPSTATUSL_ENTRY );
+    RArray<TUint> registeredAppIdArray;
+    CleanupClosePushL(registeredAppIdArray);
+    if ( aAppIdBuffer.Compare( KWildCard()) != KErrNone )
+        {
+        // If the appID is not wildcard character(*)
+        TInt appIdInt(0);
+        TLex8 lex( aAppIdBuffer );
+        lex.Val(appIdInt);  // No need to check the return code as it has been verified earlier
+        aErr = AuthorizeApp( appIdInt );
+        if ( aErr != ETerminalModeSuccess )
+             {
+             CleanupStack::PopAndDestroy(&registeredAppIdArray);
+             OstTrace0( TRACE_ERROR, CUPNPTMSERVERIMPL_GETAPPSTATUSL, "CUpnpTmServerImpl::GetAppStatusL" );
+             return;  // return if the requested appID is non-existent or un-authorized
+             }    
+        // add to the array for which get app status has to be retreived
+        registeredAppIdArray.AppendL(appIdInt);   
+        }
+    else
+        {
+        // Fetch the list of registered apps from the App store
+        for ( TInt i(0); i < iAppStore->AppIdArray().Count(); i++ )
+            {
+            registeredAppIdArray.AppendL(iAppStore->AppIdArray()[i]);       
+            }
+        }
+    iResponseBuf.Close();
+    iResponseBuf.CreateL(KActionBufferLength);
+    AppendDataL(KAppStatusListStart);
+    for ( TInt i(0); i < registeredAppIdArray.Count(); i++ )
+        {
+        CreateGetAppStatusResponseL( registeredAppIdArray[i], aErr );
+        if ( aErr != ETerminalModeSuccess )
+            {
+            /* Should return an error code if it fails to retrieve the 
+               status for even a single application */
+            break;
+            }         
+        }
+    AppendDataL(KAppStatusListEnd);
+    aAppStatusResponse.CreateL(iResponseBuf);
+    CleanupStack::PopAndDestroy(&registeredAppIdArray);
+    OstTraceFunctionExit0( DUP2_CUPNPTMSERVERIMPL_GETAPPSTATUSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::CreateGetAppStatusResponseL
+// Helper method for GetApplicationStatus response buffer construction
+// @param aAppId AppID
+// @param aErr[out]  Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::CreateGetAppStatusResponseL( TUint aAppId,TTerminalModeErrorCode& aErr )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CREATEGETAPPSTATUSRESPONSEL_ENTRY );
+    // Get the app statuses of all the requested apps one by one
+    TUint profileId;
+    RBuf8 statusType;
+    aErr = iTmServerObserver.OnGetAppStatus( aAppId, profileId, statusType);    
+    if ( aErr == ETerminalModeSuccess )
+       {
+       /* Append the status to the buffer only if the fetching of the actual status of the 
+          application from the Automotive Server is successful ,else just return the error */
+       CleanupClosePushL(statusType);
+       AppendDataL(KAppStatusStart);
+       AppendDataL(KAppIdStart);
+       AppendDataL(ConvertIntToDescriptor(aAppId));
+       AppendDataL(KAppIdEnd);
+       AppendDataL(KStatusStart);
+       AppendDataL(KProfileIdStart);
+       AppendDataL(ConvertIntToDescriptor(profileId));
+       AppendDataL(KProfileIdEnd);
+       AppendDataL(KStatusTypeStart);
+       AppendDataL(statusType);
+       AppendDataL(KStatusTypeEnd);
+       AppendDataL(KStatusEnd);
+       AppendDataL(KAppStatusEnd);
+       CleanupStack::Pop(&statusType);
+       }
+    statusType.Close();
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CREATEGETAPPSTATUSRESPONSEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GetMaxNumProfiles
+// Method is used to return the value of the state variable MaxNumProfiles, 
+// which denotes the maximum number of client profiles that are supported 
+// simultaneously by the TmClientProfile service.
+// @param aNumMaxProfiles[out] Maximum number of client profiles that are supported 
+// @return Returns Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+TTerminalModeErrorCode CUpnpTmServerImpl::GetMaxNumProfiles( TUint& aNumMaxProfiles )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GETMAXNUMPROFILES_ENTRY );
+    return iTmServerObserver.OnGetMaxNumProfiles(aNumMaxProfiles);
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::SetClientProfile
+// Method to create soap repsonse for SetClientProfile action.
+// Method allows the control point to register a client profile and
+// notify the Terminal Mode device about its preferences, settings and capabilities.
+// @param aProfileId     The identifier of the profile record where the client
+//                       profile settings must be stored
+// @param aInputClientProfile[out]  Profile information about Terminal Mode client and
+//                    its capabilities which needs to be updated in the profile record
+// @param aResultProfile[out] The updated client profile.
+// @return Returns Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+TTerminalModeErrorCode CUpnpTmServerImpl::SetClientProfile( TUint aProfileId, 
+                        const TDesC8& aInputClientProfile, RBuf8& aResultProfile )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_SETCLIENTPROFILE_ENTRY );
+    return iTmServerObserver.OnSetClientProfile( aProfileId, aInputClientProfile,
+                                                                aResultProfile );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GetClientProfile
+// Method to create soap repsonse for GetClientProfile action.
+// Method allows the control point to access the contents of a client profile stored 
+// in the Terminal Mode device.
+// @param aProfileId  The identifier of the profile record where the client 
+//                     profile settings must be stored
+// @param aClientProfile[out] Client profile corresponding to the profileID input variable
+// @return Returns Terminal Mode error code
+// ---------------------------------------------------------------------------------
+//
+TTerminalModeErrorCode CUpnpTmServerImpl::GetClientProfile( TUint aProfileId, RBuf8& aClientProfile )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GETCLIENTPROFILE_ENTRY );
+    return iTmServerObserver.OnGetClientProfile( aProfileId,aClientProfile );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GetIconInfoL
+// Method to fetch the icon file associated with the particular application. 
+// @param aUrl Relative URL of the application icon to be retreived
+// @param aResultTrans CUpnpHttpServerTransaction object
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::GetIconInfoL( const TDesC8& aUrl, CUpnpHttpServerTransaction*& aResultTrans )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GETICONINFOL_ENTRY );
+    RBuf svgFilePath;   
+    // Fetch the original file path which has been mapped to the requesting file.
+    TInt fileIndex = iIconMapping->GetSvgIconPath( aUrl,svgFilePath );
+    if ( fileIndex == KErrNotFound )
+        {
+        // In case the requested icon file is not available, should return EHttpNotFound(404). 
+        // Sets the file source as an empty descriptor.
+        aResultTrans = CUpnpIconFileServeTransaction::NewL( KNullDesC(), iIconFileSession );  
+        svgFilePath.Close();
+        OstTraceFunctionExit0( CUPNPTMSERVERIMPL_GETICONINFOL_EXIT );
+        return;
+        }
+    CleanupClosePushL(svgFilePath);
+    /* Extracts the profileID from the relative URL.
+     * The relative URL will be of the form ( /<profileID>/<iconName> )
+     */
+    const TDesC8& urlWithoutLeadingSlash = aUrl.Mid((aUrl.Locate(KForwardSlash))+1);
+    TInt secondSlashPos = urlWithoutLeadingSlash.Locate(KForwardSlash);
+    User::LeaveIfError(secondSlashPos);
+    const TDesC8& profileIdBuf = urlWithoutLeadingSlash.Left(secondSlashPos);
+    // Converts descriptor to int
+    TLex8 lex( profileIdBuf );
+    TUint profileIdInt(KErrNone);
+    lex.Val(profileIdInt);
+    // Fetch the reference to client icon preference object from AutomotiveServer
+    const CUpnpTmClientIconPref& clientIconPref = iTmServerObserver.GetClientIconPrefsL(profileIdInt);
+    
+    TInt servingIconWidth(KErrNone);
+    TInt servingIconHeight(KErrNone);
+    /* 
+     * Checks whether the conversion of the icon file needed.
+     * If conversion is required, it also determines the dimension(width and height) 
+     * of the serving file.
+     */ 
+    TBool iconConversionNeeded = iIconMapping->IsConversionNeeded( fileIndex, clientIconPref, servingIconWidth,servingIconHeight );
+    if ( iconConversionNeeded )
+        {
+        // Icon file conversion is needed( svg to bmp )
+        CUpnpSvgImageConverter* decoder = CUpnpSvgImageConverter::NewL( servingIconWidth, servingIconHeight );
+        CleanupStack::PushL(decoder);
+        RBuf bitmapBuf;
+        CleanupClosePushL(bitmapBuf);
+        decoder->ConvertToBitmapL( svgFilePath, bitmapBuf );  // Method which in turn invokes the conversion
+        aResultTrans = CUpnpIconFileServeTransaction::NewL( bitmapBuf, iIconFileSession ); /* Sets the data source( file ) 
+                                                                                           which needs to be serverd*/
+        CleanupStack::PopAndDestroy( 2,decoder);
+        }
+    else
+        {
+        // No icon file conversion needed ( svg icon is served )
+        aResultTrans = CUpnpIconFileServeTransaction::NewL( svgFilePath, iIconFileSession );
+        }
+    CleanupStack::PopAndDestroy(&svgFilePath);
+    OstTraceFunctionExit0( DUP1_CUPNPTMSERVERIMPL_GETICONINFOL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::StartDeviceL
+// Method is used to start publishing the terminal mode server device and 
+// its services
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::StartDeviceL()
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_STARTDEVICEL_ENTRY );
+    iTmServerDevice->StartTmServerDeviceL();
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_STARTDEVICEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::StopDeviceL
+// Method is used to stop publishing the terminal mode server device and 
+// its services
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::StopDeviceL()
+    {   
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_STOPDEVICEL_ENTRY );
+    iTmServerDevice->StopTmServerDeviceL();
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_STOPDEVICEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GetRemotableApp
+// Method is invoked by the Automotive Server to get the access to the particular
+// instance of the remotable app corresponding to the app ID provided.
+// This is needed in case AS wishes to modify any paramters of the already 
+// registered remotable app
+// @param aAppId App ID of the application whose access is needed
+// @param aErr[out]  Error code
+// @returns Returns reference to the Remotable App object
+// ---------------------------------------------------------------------------------
+//
+CUpnpRemotableApp& CUpnpTmServerImpl::GetRemotableApp( TUint aAppId, TInt& aErr )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GETREMOTABLEAPP_ENTRY );
+    aErr = KErrNotFound;
+    TInt appIndex = iAppStore->AppIdArray().Find(aAppId);
+    CUpnpRemotableApp* remotableApp = NULL;
+    if ( appIndex != KErrNotFound )
+        {
+        // The requested application is available
+        aErr = KErrNone;    
+        remotableApp = &(iAppStore->FetchRemotableApp(appIndex));  
+        }
+    OstTraceExt2( TRACE_NORMAL, CUPNPTMSERVERIMPL_GETREMOTABLEAPP, "CUpnpTmServerImpl::GetRemotableApp;aAppId=%d;aErr=%d", aAppId, aErr );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_GETREMOTABLEAPP_EXIT );
+    return *remotableApp;
+    }
+
+// ---------------------------------------------------------------------------------
+// Method is used to un-register the individual applications 
+// @param aRemotableApp  Pointer to Remotable app object which needs to 
+ //                      be registered.Ownership is passed.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::RegisterAppL( CUpnpRemotableApp* aRemotableApp )
+    {   
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_REGISTERAPPL_ENTRY );
+    ASSERT( aRemotableApp );   
+    iAppStore->AddRemotableAppL( aRemotableApp );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_REGISTERAPPL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::RegisterAppsL
+// Method is used to register multiple applications in one go
+// @param aRemotableAppList Array of Remotable App objects which needs to be
+//                          registered. Ownership is passed.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::RegisterAppsL( const RPointerArray<CUpnpRemotableApp>& aRemotableAppList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_REGISTERAPPSL_ENTRY );
+    for ( TInt i(0); i < aRemotableAppList.Count(); i++ )
+        {
+        iAppStore->AddRemotableAppL( aRemotableAppList[i] );
+        }
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_REGISTERAPPSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::UnRegisterApp
+// Method is used to un-register the individual applications 
+// @param aAppId App ID which needs to be un-registered
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerImpl::UnRegisterApp( TUint aAppId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_UNREGISTERAPP_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVER_GETREMOTABLEAPP, "CUpnpTmServer::GetRemotableApp;aAppId=%u", aAppId );
+    return iAppStore->RemoveRemotableApp(aAppId);
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::UnRegisterApps
+// Method is used to un-register multiple applications in one go 
+// param aAppIdArray an array of appIDs which needs to be un-registered
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmServerImpl::UnRegisterApps( const RArray<TUint>& aAppIdArray )
+    {   
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_UNREGISTERAPPS_ENTRY );
+    /**
+     * Create a copy of the array.
+     * Only distinct and unique app IDs are copied into the array.
+     */
+    RArray<TUint> appIdList ;
+    TInt i;
+    for ( i = 0; i < aAppIdArray.Count(); i++ )
+        {
+        OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_UNREGISTERAPPS, "CUpnpTmServerImpl::UnRegisterApps;aAppIdArray[i]=%d", aAppIdArray[i] );
+        if ( appIdList.Find(aAppIdArray[i]) == KErrNotFound )
+            {
+            appIdList.Append(aAppIdArray[i]);
+            }
+        }
+    for ( i = 0; i < appIdList.Count(); i++ )
+        { 
+        // Now remove the remotable app from the array one by one
+        if ( ( iAppStore->RemoveRemotableApp( appIdList[i] )) == KErrNotFound )
+            {
+            /** 
+              * Even if a single app from the requested array is unable 
+              * to get un-registered the method should return KErrNotFound 
+              */
+            OstTrace1( TRACE_ERROR, DUP1_CUPNPTMSERVERIMPL_UNREGISTERAPPS, "CUpnpTmServerImpl::UnRegisterApps;appIdList[i]=%d", appIdList[i] );
+            appIdList.Close();
+            OstTraceFunctionExit0( CUPNPTMSERVERIMPL_UNREGISTERAPPS_EXIT );
+            return KErrNotFound;
+            }
+        }  
+    appIdList.Close();
+    OstTraceFunctionExit0( DUP1_CUPNPTMSERVERIMPL_UNREGISTERAPPS_EXIT );
+    return KErrNone;      
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::SetXmlSignatureL
+// Method is used to add xml formatted signature value to the list of remotable 
+// apps which is provided in response to the GetApplicationList action.
+// XML signature is applied over entire contents of the appList element
+// @param aSignature XML formatted signature value
+//                              objects
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::SetXmlSignatureL( const TDesC8& aSignature )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_SETXMLSIGNATUREL_ENTRY );
+    iXmSignature.Close();
+    iXmSignature.CreateL(aSignature);
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_SETXMLSIGNATUREL_EXIT );
+    }
+
+// --------------------------------------------------------------------------------------------------------------------
+// CUpnpTmServerImpl::XmlSignature
+// Method is used to fetch xml formatted signature value 
+// @return Returns xml formatted signature buffer 
+// --------------------------------------------------------------------------------------------------------------------
+//
+const TDesC8& CUpnpTmServerImpl::XmlSignature( )const
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_XMLSIGNATURE_ENTRY );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_XMLSIGNATURE_EXIT );
+    return iXmSignature;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::UpdateAppStatusL
+// Method is used to update the status of applications which have undergone some 
+// change. This method is invoked by Automotive Server
+// @param aUpdatedAppIdList An array of app IDs corresponding to the applications
+//                          whose status have have undergone change
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::UpdateAppStatusL( const RArray<TUint>& aUpdatedAppIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_UPDATEAPPSTATUSL_ENTRY );
+    CreateEventMessageL(aUpdatedAppIdList);
+    iTmServerDevice->AppStatusUpdateL(iResponseBuf);
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_UPDATEAPPSTATUSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::UpdateAppListL
+// Method is used to update the list of applications which have been either added,
+// removed or modified. This method is invoked by Automotive Server
+// @param aUpdatedAppIdList An array of app IDs corresponding to the applications
+//                          which have added, removed or modified to/from the list
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::UpdateAppListL( const RArray<TUint>& aUpdatedAppIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_UPDATEAPPLISTL_ENTRY );
+    CreateEventMessageL(aUpdatedAppIdList);
+    iTmServerDevice->AppListUpdateL(iResponseBuf);    
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_UPDATEAPPLISTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::UpdateUnusedProfileIdsL
+// Method is used to update the list of profile IDs for profiles which are currently  
+// not being used by any Terminal Mode service hosted.on the Terminal Mode device
+// This method is invoked by Automotive Server
+// @param aUnusedProfileIdList List of profile IDs for profiles which are currently 
+//                             not being used
+//                             
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::UpdateUnusedProfileIdsL( const RArray<TUint>& aUnusedProfileIdList )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_UPDATEUNUSEDPROFILEIDSL_ENTRY );
+    CreateEventMessageL(aUnusedProfileIdList);
+    iTmServerDevice->UnUsedProfileIdUpdateL(iResponseBuf);     
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_UPDATEUNUSEDPROFILEIDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::AuthorizeApp
+// This method is used to verify whether the requested appID exists and whether
+// the client is authorized to perform the oprations on that App ID
+// @param aAppID  appID which for which operation is requested
+// @return Returns ETerminalModeSuccess if appID is valid and authorized 
+//         else the error code
+// ---------------------------------------------------------------------------------
+//
+TTerminalModeErrorCode CUpnpTmServerImpl::AuthorizeApp( TUint aAppId )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_AUTHORIZEAPP_ENTRY );
+    OstTrace1( TRACE_NORMAL, DUP2_CUPNPTMSERVERIMPL_AUTHORIZEAPP, "CUpnpTmServerImpl::AuthorizeApp;aAppId=%u", aAppId );
+    
+    TTerminalModeErrorCode err;
+    if ( iAppStore->AppIdArray().Find(aAppId) != KErrNotFound )
+        {
+        // requested appID is a valid one
+        err = ETerminalModeSuccess;
+        }
+    else
+        {
+        // Requested appID does not exist
+        err = ETerminalModeBadAppId;
+        }
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_AUTHORIZEAPP, "CUpnpTmServerImpl::AuthorizeApp;err=%d", err );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_AUTHORIZEAPP_EXIT );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::AppendDataL
+// Appends data to the buffer and also reallocates when needed
+// @param aData data to be appended to the buffer
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::AppendDataL( const TDesC8& aData )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_APPENDDATAL_ENTRY );
+    TInt actionBufMaxLen = iResponseBuf.MaxLength();
+    TInt actionBufLen = iResponseBuf.Length();
+    TInt dataLen = aData.Length();
+    if ( actionBufMaxLen < ( actionBufLen + dataLen ) )
+        {
+        TInt lenToAllocate = (dataLen > KActionBufferLength) ? dataLen : KActionBufferLength;
+        iResponseBuf.ReAllocL ( actionBufLen + lenToAllocate );
+        }   
+    iResponseBuf.Append( aData );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_APPENDDATAL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::ConstructActionResponseBufferL
+// Constructs the actual soap response buffer
+// @param aAppIndex Index of the registered App
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::ConstructActionResponseBufferL( TInt aAppIndex )    
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CONSTRUCTACTIONRESPONSEBUFFERL_ENTRY );
+    ConstructLeadingSoapBufferL(aAppIndex);
+    const TDesC8& appDesc = iAppStore->FetchRemotableApp(aAppIndex).AppDescription();
+    if ( appDesc.Length() != KErrNone )
+        {
+        // Appends the application desciption
+        AppendDataL(KStartNameDesc);
+        AppendDataL(appDesc);
+        AppendDataL(KEndNameDesc);   
+        } 
+    // Appends the optional icon information to the soap response buffer only 
+    // if its available.
+    const RPointerArray<CUpnpTerminalModeIcon>& iconList = iAppStore->FetchRemotableApp(aAppIndex).IconList();
+    TInt iconCount = iconList.Count();
+    if ( iconCount > KErrNone )
+        {
+        // Icon information is present
+        AppendDataL(KStartIconList);                     
+        for ( TInt j(0); j < iconCount; j++ )
+            {
+            // Adds all the icons associated with this app one by one
+            SetRemotableAppIconInfoL( *iconList[j] );
+            }
+        AppendDataL(KEndIconList);
+        }
+    //Apends the allowedProfileIDs element
+    SetAllowedProfileIdListL(aAppIndex);
+    //Appends the different terminalmode info elements
+    const RPointerArray<CUpnpTmInfoElement>& tmInfoElementList = 
+                                 iAppStore->FetchRemotableApp(aAppIndex).TmInfoElementList();
+    for ( TInt k(0); k < tmInfoElementList.Count(); k++)
+        {
+        // Called for each terminal mode element associated with the App
+        SetTerminalModeInfoElementL( *tmInfoElementList[k] );
+        }
+    // Appends the resource status element for the app if it is available 
+    SetResourceStatusL(aAppIndex);
+    // End of an application
+    AppendDataL(KEndApp);
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CONSTRUCTACTIONRESPONSEBUFFERL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::ConstructLeadingSoapBufferL
+// Constructs leading soap buffer
+// It adds appID and appName to the soap response
+// @param aAppIndex Index of the remotable app
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::ConstructLeadingSoapBufferL( TInt aAppIndex )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CONSTRUCTLEADINGSOAPBUFFERL_ENTRY );
+    AppendDataL(KStartApp);
+    AppendDataL(KAppIdStart);
+    AppendDataL(ConvertIntToDescriptor(iAppStore->FetchRemotableApp(aAppIndex).AppId()));
+    AppendDataL(KAppIdEnd);
+    AppendDataL(KNameStart);
+    AppendDataL(iAppStore->FetchRemotableApp(aAppIndex).AppName());
+    AppendDataL(KNameEnd);
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CONSTRUCTLEADINGSOAPBUFFERL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::SetRemotableAppIconInfoL
+// Appends application icon information to the soap response buffer.
+// It stores the icon information in Tm Icon Mapping object for further reference.
+// @param aTmIcon  Reference to icon object 
+// @param aWidth   Width of the application icon.
+// @param aHeight  Height of the application icon.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::SetRemotableAppIconInfoL( const CUpnpTerminalModeIcon& aTmIcon )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_SETREMOTABLEAPPICONINFOL_ENTRY );
+    AppendDataL(KIconStart);
+    AppendDataL(KMimeTypeStart);
+    AppendDataL(aTmIcon.MimeType());
+    AppendDataL(KMimeTypeEnd);
+    AppendDataL(KWidthStart);
+    TInt width = aTmIcon.Width();
+    AppendDataL(ConvertIntToDescriptor(width));
+    AppendDataL(KWidthEnd);
+    AppendDataL(KHeightStart);
+    TInt height = aTmIcon.Height();
+    AppendDataL(ConvertIntToDescriptor(height));
+    AppendDataL(KHeightEnd);
+    AppendDataL(KDepthStart);
+    AppendDataL(ConvertIntToDescriptor(aTmIcon.Depth()));
+    AppendDataL(KDepthEnd);
+    //Application icon URL creation
+    AppendDataL(KUrlStart);
+    AppendDataL(UpnpHTTP::KHTTPUrl());        
+    AppendDataL(iAddrBuf);  // Adds IP address
+    AppendDataL(KColon);
+    AppendDataL(iPortBuf);  // Adds port number
+    
+    // Fetch the icon file path
+    const TDesC& filePath = aTmIcon.IconFilename();
+    // Extract just filename from the complete file path
+    const TDesC& fileName = filePath.Mid((filePath.LocateReverse(KDirectorySeparator))+1);
+    TBuf8<UpnpString::KDefaultStringLength> fileName8;
+    fileName8.Copy(fileName);  // 16-bit to 8-bit conversion( icon filename )
+    
+    TBuf8<UpnpString::KDefaultStringLength> iconRelativeUrl(UpnpString::KSlash);
+    // Appends the client profileID
+    iconRelativeUrl.Append(ConvertIntToDescriptor(iProfileId));
+    iconRelativeUrl.Append(UpnpString::KSlash);   
+    // Appends the icon filename and creates the relative url
+    iconRelativeUrl.Append(fileName8);
+    AppendDataL(iconRelativeUrl);
+    /** Icon information is stored for making decision during http request for app icon file.
+     *  Depth is not taken into consideration while deciding on the final icon dimension
+     *  because it is not a requirement and playing with the depth of the icon may lead
+     *  to a poorly converted image which may not be displayed properly in the car 
+     *  kit screen.
+     */
+    iIconMapping->AddIconFileInfoL( iconRelativeUrl,filePath,width,height );
+    AppendDataL(KUrlEnd);
+    AppendDataL(KIconEnd);
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_SETREMOTABLEAPPICONINFOL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::SetAllowedProfileIdListL
+// Appends  the list of allowed profile IDs information to the soap response buffer
+// @param aAppIndex Index of the registered app
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::SetAllowedProfileIdListL( TInt aAppIndex )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_SETALLOWEDPROFILEIDLISTL_ENTRY );
+    const RArray<TUint>& profileIdList = iAppStore->FetchRemotableApp(aAppIndex).AllowedProfileIdList();
+    TInt profileIdCount = profileIdList.Count();
+    if ( profileIdCount > KErrNone )
+        {
+        AppendDataL(KAllowedProfileIdsStart);
+        for ( TInt i(0); i < profileIdCount; i++ )
+            {
+            AppendDataL(ConvertIntToDescriptor(profileIdList[i]));
+            if ( i < (profileIdCount-1) )
+                {
+                // Adds comma after each profile ID except last 
+                AppendDataL(UpnpString::KComa);
+                }
+            }
+        AppendDataL(KAllowedProfileIdsEnd);
+        }
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_SETALLOWEDPROFILEIDLISTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::SetTerminalModeInfoElementL
+// Appends terminal mode info elements to the soap buffer
+// @param aTmInfoElement Reference to CUpnpTmInfoElement object
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::SetTerminalModeInfoElementL( const CUpnpTmInfoElement&  aTmInfoElement )                                                              
+    {  
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_SETTERMINALMODEINFOELEMENTL_ENTRY );
+    AppendDataL(KStartTagOpenBracket);
+    AppendDataL(aTmInfoElement.TerminalModeInfoType());
+    AppendDataL(KCloseBracket);
+    for ( TInt i(0); i < aTmInfoElement.TmInfoElementCount(); i++ )
+        {
+        RBuf8 elementName;
+        CleanupClosePushL(elementName);
+        RBuf8 elementValue;
+        CleanupClosePushL(elementValue);
+        // Fetch the key-value pair
+        aTmInfoElement.GetTmInfoElementL( elementName, elementValue, i );
+        AppendDataL(KStartTagOpenBracket);
+        AppendDataL(elementName);
+        AppendDataL(KCloseBracket);
+        AppendDataL(elementValue); 
+        AppendDataL(KEndTagOpenBracket);
+        AppendDataL(elementName);
+        AppendDataL(KCloseBracket);
+        CleanupStack::PopAndDestroy(2,&elementName);
+        }   
+    AppendDataL(KEndTagOpenBracket);
+    AppendDataL(aTmInfoElement.TerminalModeInfoType());
+    AppendDataL(KCloseBracket);
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_SETTERMINALMODEINFOELEMENTL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::SetResourceStatusL
+// Appends resource status element(optional element)to the soap response buffer.
+// Provides the status of the resource of the application.
+// @param aAppIndex Index of the registered app
+// --------------------------------------------------------------------------------- 
+//
+void CUpnpTmServerImpl::SetResourceStatusL( TInt aAppIndex )
+    {  
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_SETRESOURCESTATUSL_ENTRY );
+    const TDesC8& rscStatus = iAppStore->FetchRemotableApp(aAppIndex).ResourceStatus();
+    if ( rscStatus.Length() > KErrNone ) 
+        {
+        AppendDataL(KResourceStatusStart);
+        AppendDataL(rscStatus);
+        AppendDataL(KResourceStatusEnd);
+        }
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_SETRESOURCESTATUSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::GenerateUrlComponents
+// Utility method to generate Server's IP address and port number which is used 
+// in constructing the icon url in action responses
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::GenerateUrlComponents( CUpnpHttpServerSession& aHttpServerSession )   
+   {
+   OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_GENERATEURLCOMPONENTS_ENTRY );
+   TInetAddr servAddr;
+   servAddr.SetFamily(KAfInet);
+   aHttpServerSession.GetAddress( servAddr );
+   TBuf<UpnpString::KShortStringLength> addrBuf8;
+   servAddr.Output( addrBuf8 );
+   iAddrBuf.Copy(addrBuf8); //Sets the IP address of the server
+   iPortBuf.Num(servAddr.Port()); //Sets the port number
+   OstTraceFunctionExit0( CUPNPTMSERVERIMPL_GENERATEURLCOMPONENTS_EXIT );
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::CreateEventMessageL
+// Utility method to generate GENA notificatiion messages.
+// Its is called in case of updateapplist, updateappstatuslist and
+// unusedprofileidlist events.
+// @param aIdList Reference to the changed ID list. It could be appID list or 
+//                profileID list.
+// ---------------------------------------------------------------------------------
+//
+void CUpnpTmServerImpl::CreateEventMessageL( const RArray<TUint>& aIdList )   
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CREATEEVENTMESSAGEL_ENTRY );
+    iResponseBuf.Close();
+    iResponseBuf.CreateL(KActionBufferLength);
+    /**
+     * Create a copy of the array.
+     * Only distinct and unique elements are copied into the array.
+     */
+    RArray<TUint> idList;
+    CleanupClosePushL(idList);
+    TInt i;
+    for ( i = 0; i < aIdList.Count(); i++ )
+        {
+        OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_CREATEEVENTMESSAGEL, "CUpnpTmServerImpl::CreateEventMessageL;aIdList[i]=%d", aIdList[i] );
+        if ( idList.Find(aIdList[i]) == KErrNotFound )
+            {
+            idList.AppendL(aIdList[i]);
+            }
+        }
+    TInt idCount = idList.Count();
+    for ( i = 0; i < idCount; i++ )
+        {  
+        AppendDataL(ConvertIntToDescriptor( idList[i]));
+        if ( i < ( idCount-1) )
+            {
+            //Add comma(,) after each ID except the last
+            AppendDataL(UpnpString::KComa);
+            }
+    }
+   CleanupStack::PopAndDestroy(&idList);
+   OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CREATEEVENTMESSAGEL_EXIT );
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerImpl::ConvertIntToDescriptor
+// Utility method to convert integer to descriptor
+// @param  aIntVal  Integer value
+// @return  Returns corresponding descriptor value
+// ---------------------------------------------------------------------------------
+//
+const TDesC8& CUpnpTmServerImpl::ConvertIntToDescriptor( TInt aIntVal )
+    {
+    OstTraceFunctionEntry0( CUPNPTMSERVERIMPL_CONVERTINTTODESCRIPTOR_ENTRY );
+    OstTrace1( TRACE_NORMAL, CUPNPTMSERVERIMPL_CONVERTINTTODESCRIPTOR, "CUpnpTmServerImpl::ConvertIntToDescriptor;aIntVal=%d", aIntVal );
+    iBufVal.Num( aIntVal );
+    OstTraceFunctionExit0( CUPNPTMSERVERIMPL_CONVERTINTTODESCRIPTOR_EXIT );
+    return iBufVal;
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/traces/OstTraceDefinitions.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,22 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OST trace file.
+*
+*/
+
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/bwins/upnptmservertestu.DEF	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/TestFramework.ini	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,217 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                              #                      'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 120000                    # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= upnptmservertest 
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# 	If you want to use filter with ConsoleUI, simply remove comments
+# 	from section below and provide valid filter entries.
+#   Each filter line has to start with "filter= " keyword.
+#   Filter can contain special wildcard characters:
+#     *  which stands for none or any literal;
+#     ?  which stands for single character.
+#   Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/gallery.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 36 44">
+<g>
+<g>
+<rect fill="none" width="36" height="44"/>
+<g>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="-14.4209" y1="4.2197" x2="18.0901" y2="43.6343">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.1142" style="stop-color:#E0EAF3"/>
+<stop offset="0.35" style="stop-color:#A2C2DD"/>
+<stop offset="0.4825" style="stop-color:#8CA9CF"/>
+<stop offset="0.7" style="stop-color:#6C83BB"/>
+<stop offset="0.7458" style="stop-color:#637DB5"/>
+<stop offset="0.8189" style="stop-color:#4C6EA4"/>
+<stop offset="0.9097" style="stop-color:#265689"/>
+<stop offset="0.9888" style="stop-color:#003D6D"/>
+<stop offset="1" style="stop-color:#003D6D"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M4.926,32.898V21.056c-0.156-0.018-1.505-0.163-2.099-0.745v14.748h14.597v-2.16H4.926z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="3.5293" y1="-10.4531" x2="35.8526" y2="28.7339">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.1142" style="stop-color:#E0EAF3"/>
+<stop offset="0.35" style="stop-color:#A2C2DD"/>
+<stop offset="0.4825" style="stop-color:#8CA9CF"/>
+<stop offset="0.7" style="stop-color:#6C83BB"/>
+<stop offset="0.7458" style="stop-color:#637DB5"/>
+<stop offset="0.8189" style="stop-color:#4C6EA4"/>
+<stop offset="0.9097" style="stop-color:#265689"/>
+<stop offset="0.9888" style="stop-color:#003D6D"/>
+<stop offset="1" style="stop-color:#003D6D"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M32.229,11.113H12.192c0,0.814,0,1.568-0.003,2.16h17.938v4.547h2.102V11.113z"/>
+</g>
+<path fill="#496DA2" d="M28.954,20.28v2.103h-5.772V20.28h-3.3v14.812h3.3v-2.096h5.772v2.096h3.328V20.28H28.954z      M22.154,34.199h-1.36v-2.08h1.36V34.199z M22.154,30.408h-1.36v-2.08h1.36V30.408z M22.154,26.908h-1.36v-2.08h1.36V26.908z      M22.154,23.118h-1.36v-2.08h1.36V23.118z M28.982,30.894h-5.801v-6.409h5.801V30.894z M31.343,34.199h-1.36v-2.08h1.36V34.199z      M31.343,30.408h-1.36v-2.08h1.36V30.408z M31.343,26.908h-1.36v-2.08h1.36V26.908z M31.343,23.118h-1.36v-2.08h1.36V23.118z"/>
+<path fill="#496DA2" d="M18.353,18.278V16.27H15.99v2.368l-7.078,7.101H6.327l4.8,4.751v-0.02h6.297V18.278H18.353z      M15.99,25.739h-4.729l4.729-4.735V25.739z"/>
+<path fill="#496DA2" d="M8.597,3.858v8.868c-1.074-0.134-2.391,0.17-3.513,0.904c-1.92,1.259-2.533,3.282-1.652,4.625     c0.877,1.34,3.191,1.242,5.111-0.019c1.119-0.8,1.91-1.999,1.752-3.6l-0.004-8.142l3.837,1.919l0.667-1.451L8.597,3.858z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/homemedia.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 60 60">
+<g>
+<rect fill="none" width="60" height="60"/>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="48.6304" y1="26.9165" x2="48.6304" y2="46.1203">
+<stop offset="0" style="stop-color:#FBFBFB"/>
+<stop offset="0.0056" style="stop-color:#FBFBFB"/>
+<stop offset="0.1601" style="stop-color:#F7F7F7"/>
+<stop offset="0.3124" style="stop-color:#EBEBEB"/>
+<stop offset="0.4639" style="stop-color:#D7D8D8"/>
+<stop offset="0.615" style="stop-color:#BCBCBC"/>
+<stop offset="0.7657" style="stop-color:#989898"/>
+<stop offset="0.9142" style="stop-color:#6D6D6D"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M48.402,31.688c0,0-0.328-0.25-0.4-0.309c0,5.336,0,15.445,0,15.445    c0,1.281-1.072,2.004-1.732,2.113c0,0,3.441-0.931,3.938-1.343c0.498-0.412,0.787-1.024,0.787-1.67c0,0,0-8.694,0-14.028    l-0.918,0.213C49.482,32.208,48.876,32.055,48.402,31.688z"/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="31.7593" y1="11.7866" x2="54.2702" y2="29.973">
+<stop offset="0" style="stop-color:#FBFBFB"/>
+<stop offset="0.0056" style="stop-color:#FBFBFB"/>
+<stop offset="0.1346" style="stop-color:#F4F4F4"/>
+<stop offset="0.3214" style="stop-color:#E1E1E1"/>
+<stop offset="0.5434" style="stop-color:#C1C2C2"/>
+<stop offset="0.7904" style="stop-color:#969797"/>
+<stop offset="0.9101" style="stop-color:#7E7F7F"/>
+<stop offset="0.9247" style="stop-color:#6E6F6F"/>
+<stop offset="0.9465" style="stop-color:#5D5E5E"/>
+<stop offset="0.9703" style="stop-color:#535454"/>
+<stop offset="1" style="stop-color:#505151"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M54.978,25.735L36.181,10.178c-0.918-0.724-2.008-0.491-2.441-0.373l-2.368,0.678    c0.741-0.316,1.603-0.203,2.233,0.318l18.798,15.556c0.853,0.709,1.036,1.948,0.419,2.873l-1.295,1.944    c-0.271,0.406-0.674,0.698-1.132,0.85c0,0,1.745-0.334,2.257-0.537c0.557-0.221,1.117-0.437,1.451-0.936l1.297-1.945    C56.015,27.682,55.833,26.443,54.978,25.735z"/>
+<path fill="#FFFFFF" d="M31.171,10.576l-17.502,9.723c-0.912,0.507-1.333,1.59-1.004,2.58l0.648,1.946    c0.2,0.598,0.651,1.082,1.237,1.319c0.585,0.24,1.245,0.212,1.807-0.078c0,0,0.082-0.04,0.086-0.043c0,4.709,0,15.617,0,15.617    c0,1.04,0.738,1.936,1.761,2.129l27.224,5.184c0.633,0.123,1.289-0.045,1.786-0.458c0.498-0.411,0.786-1.023,0.786-1.669    c0,0,0-10.109,0-15.445c0.072,0.059,0.4,0.309,0.4,0.309c0.475,0.367,1.08,0.52,1.674,0.422c0.593-0.097,1.118-0.436,1.451-0.936    l1.295-1.944c0.617-0.925,0.434-2.164-0.419-2.873L33.605,10.801C32.917,10.231,31.951,10.143,31.171,10.576z"/>
+<path fill="#9E0A00" d="M32.223,12.471l-17.501,9.723l0.648,1.945l3.24-1.662v19.162l25.96,5.908l1.264-0.723V26.973l2.625,3.721    l1.265-0.723l1.297-1.944L32.223,12.471z M36.111,43.583l-9.074-1.598v-13.31l9.074,1.296V43.583z"/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="50.186" y1="14.5874" x2="15.5621" y2="48.3462">
+<stop offset="0" style="stop-color:#FF0000"/>
+<stop offset="0.0056" style="stop-color:#FF0000"/>
+<stop offset="0.3122" style="stop-color:#FC0000"/>
+<stop offset="0.5019" style="stop-color:#F40000"/>
+<stop offset="0.6598" style="stop-color:#E50000"/>
+<stop offset="0.8002" style="stop-color:#D10000"/>
+<stop offset="0.9278" style="stop-color:#B70000"/>
+<stop offset="1" style="stop-color:#A40000"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M30.958,13.193l-17.5,9.724l0.648,1.944l3.24-1.661v19.161l27.224,5.187V27.696l3.889,2.998    l1.297-1.945L30.958,13.193z M34.847,44.307l-9.075-1.602V29.398l9.075,1.296V44.307z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="32.4409" y1="37.5884" x2="5.1013" y2="27.8632">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.0312" style="stop-color:#F7FBFF"/>
+<stop offset="0.0801" style="stop-color:#E0F2FE"/>
+<stop offset="0.1406" style="stop-color:#BCE2FE"/>
+<stop offset="0.2103" style="stop-color:#89CCFD"/>
+<stop offset="0.2877" style="stop-color:#48B0FB"/>
+<stop offset="0.3652" style="stop-color:#0091FA"/>
+<stop offset="1" style="stop-color:#003B7D"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M4.715,22.201c-0.172,2.038,0.137,4.193,0.813,6.059c3.023,8.332,17.155,12.911,27.192,9.713    l-0.069-1.294c-5.002,0.745-19.458-0.917-22.94-10.087L4.715,22.201"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="20.0659" y1="10.2148" x2="6.6073" y2="23.728">
+<stop offset="0" style="stop-color:#0087E9"/>
+<stop offset="0.0056" style="stop-color:#0087E9"/>
+<stop offset="0.5225" style="stop-color:#0062B7"/>
+<stop offset="1" style="stop-color:#003B7D"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M5.933,21.764c1.361-6.763,9.869-10.551,14.595-11.4l-0.012,0.667    c-6.487,1.344-13.667,7.526-10.805,14.643"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="21.8657" y1="26.9482" x2="-7.7333" y2="6.8177" gradientTransform="matrix(0.999 -0.0456 0.0456 0.999 11.277 7.4644)">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.0056" style="stop-color:#FFFFFF"/>
+<stop offset="0.0309" style="stop-color:#F9FDFF"/>
+<stop offset="0.0661" style="stop-color:#E7F9FF"/>
+<stop offset="0.1071" style="stop-color:#C9F1FF"/>
+<stop offset="0.1525" style="stop-color:#A0E7FF"/>
+<stop offset="0.2009" style="stop-color:#6BD9FF"/>
+<stop offset="0.2247" style="stop-color:#4FD2FF"/>
+<stop offset="0.3686" style="stop-color:#4DCEFC"/>
+<stop offset="0.4988" style="stop-color:#47C3F3"/>
+<stop offset="0.6237" style="stop-color:#3CB1E4"/>
+<stop offset="0.7454" style="stop-color:#2D97D0"/>
+<stop offset="0.8647" style="stop-color:#1A76B5"/>
+<stop offset="0.9807" style="stop-color:#034D94"/>
+<stop offset="0.9944" style="stop-color:#004890"/>
+<stop offset="1" style="stop-color:#004890"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M9.633,24.964c4.732,12.648,22.544,11.901,23.018,11.715C22.617,39.92,7.979,35.225,5.279,26.655    C1.24,13.841,18.506,10.224,20.559,10.352C14.072,11.794,6.764,17.294,9.633,24.964z"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/maps.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 88 87.999">
+<g>
+<g>
+<g>
+<g>
+<rect fill="none" width="88" height="87.999"/>
+</g>
+</g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="12.3042" y1="18.3799" x2="63.4113" y2="79.287">
+<stop offset="0" style="stop-color:#B3DDFF"/>
+<stop offset="0.8146" style="stop-color:#084296"/>
+<stop offset="1" style="stop-color:#084296"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M32.135,7.415L14.363,17.432v23.167c0,0,8.926,15.351,10.468,18.001       c-2.386,1.704-15.44,11.03-15.44,11.03l21.613,12.652c0,0,12.907-9.85,14.71-11.226c1.979,1.109,16.231,9.101,16.231,9.101       l16.664-15.132c0,0-14.066-6.929-16.888-8.318c1.467-3.01,10.531-21.604,10.531-21.604l-22.298-9.59       c0,0-1.486,3.173-2.093,4.467c-2.046-0.88-6.573-2.826-6.573-2.826s-3.713,2.463-5.696,3.778       c-0.327-0.744-0.542-1.233-0.657-1.495c0.007-0.824,0.213-23.72,0.213-23.72L32.135,7.415z"/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="40.8276" y1="52.1914" x2="16.1997" y2="21.1353">
+<stop offset="0" style="stop-color:#5AA7E0"/>
+<stop offset="1" style="stop-color:#3366CC"/>
+</linearGradient>
+<polygon fill="url(#XMLID_8_)" points="59.051,57.621 69.536,36.111 50.944,28.115 48.852,32.581 41.493,29.418 34.719,33.911        32.932,29.849 33.117,9.157 16.363,18.601 16.363,40.06 27.476,59.169 13.064,69.463 30.856,79.879 45.546,68.669        61.667,77.708 75.089,65.521 "/>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="60.585" y1="31.876" x2="53.8582" y2="45.1125">
+<stop offset="0" style="stop-color:#5AA7E0"/>
+<stop offset="1" style="stop-color:#3366CC"/>
+</linearGradient>
+<polygon fill="url(#XMLID_9_)" points="41.26,48.783 50.944,28.115 69.536,36.111 59.051,57.621 "/>
+<polygon fill="#0046B7" points="16.363,40.06 27.476,59.169 41.26,48.783 32.932,29.849 "/>
+<polygon fill="#3366CC" points="16.363,40.06 16.363,18.601 33.117,9.157 32.932,29.849 "/>
+<polygon fill="#CFECFF" points="26.696,39.23 41.493,29.418 59.523,37.168 45.546,47.954 "/>
+<path fill="#5AA7E0" d="M41.954,55.286"/>
+<polygon fill="#3366CC" points="26.696,39.23 27.476,59.169 45.546,68.669 45.546,47.954 "/>
+<polygon fill="#5AA7E0" points="13.064,69.463 27.476,59.169 45.546,68.669 30.856,79.879 "/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="29.2085" y1="63.6836" x2="48.7102" y2="56.1976">
+<stop offset="0" style="stop-color:#5AA7E0"/>
+<stop offset="0.0056" style="stop-color:#5AA7E0"/>
+<stop offset="0.85" style="stop-color:#3366CC"/>
+<stop offset="1" style="stop-color:#3366CC"/>
+</linearGradient>
+<polygon fill="url(#XMLID_10_)" points="43.423,46.971 27.476,59.169 45.546,68.669 45.546,47.954 "/>
+<polygon fill="#0046B7" points="45.546,47.954 45.546,68.669 59.051,57.621 59.523,37.168 "/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="45.3936" y1="59.5186" x2="59.0508" y2="59.5186">
+<stop offset="0" style="stop-color:#0046B7"/>
+<stop offset="1" style="stop-color:#3366CC"/>
+</linearGradient>
+<polygon fill="url(#XMLID_11_)" points="45.394,50.368 45.546,68.669 59.051,57.621 "/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="60.8945" y1="68.6807" x2="57.2953" y2="58.792">
+<stop offset="0" style="stop-color:#5AA7E0"/>
+<stop offset="0.4101" style="stop-color:#5AA7E0"/>
+<stop offset="1" style="stop-color:#3366CC"/>
+</linearGradient>
+<polygon fill="url(#XMLID_12_)" points="61.667,77.708 45.546,68.669 59.051,57.621 75.089,65.521 "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/music_launched.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 21 21">
+<g>
+<path fill="url(#XMLID_2_)" stroke="#FFFFFF" stroke-width="0.5" d="M17.15,2.265L6.534,4.294v10.155   c-0.07-0.01-0.134-0.029-0.212-0.04C4.931,14.22,3.2,15.053,2.46,16.257c-0.744,1.197-0.212,2.326,1.181,2.504   c1.395,0.181,3.122-0.646,3.859-1.851c0.214-0.342,0.31-0.674,0.322-0.981c0.003-0.013,0.013-0.021,0.019-0.03   c0-0.323-0.07-8.833-0.07-8.833l8.106-1.786l0.031,7.167c-0.072-0.015-0.137-0.033-0.213-0.046   c-1.393-0.183-3.122,0.65-3.855,1.853c-0.747,1.201-0.215,2.324,1.174,2.505c1.398,0.179,3.123-0.644,3.859-1.849   c0.212-0.346,0.307-0.674,0.324-0.986c0.008-0.013,0.014-0.021,0.02-0.029C17.22,13.567,17.15,2.265,17.15,2.265z"/>
+<rect fill="none" width="21" height="21"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="2.124" y1="10.5254" x2="17.2173" y2="10.5254">
+<stop offset="0" style="stop-color:#FF7800"/>
+<stop offset="0.4" style="stop-color:#FF3300"/>
+<stop offset="1" style="stop-color:#8A1700"/>
+</linearGradient>
+</defs>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/music_unlaunched.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 21 21">
+<g>
+<g>
+<g>
+<path fill="#FFFFFF" d="M3.422,6.458c-0.536,0-1.002,0.466-1.002,1.131l-0.014,9.842c0,1.278,0.092,1.42,1.529,1.42h13.115     c0.92,0,1.172-0.4,1.172-1.341l0.014-9.587c0-0.939-0.189-1.464-1.109-1.464L4.075,6.458H3.422z"/>
+<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="2.8613" y1="12.0654" x2="17.7773" y2="12.0654">
+<stop offset="0" style="stop-color:#C2E0E1"/>
+<stop offset="0.2141" style="stop-color:#7AC0D6"/>
+<stop offset="0.6648" style="stop-color:#559BC1"/>
+<stop offset="1" style="stop-color:#1D65A2"/>
+</linearGradient>
+<path fill="url(#XMLID_5_)" d="M17.211,6.885H3.43l0,0c-0.314,0-0.568,0.259-0.568,0.571v9.775     c-0.001,0.019,14.916,0.019,14.916,0V7.456C17.777,7.144,17.523,6.885,17.211,6.885z"/>
+</g>
+<linearGradient id="XMLID_6_" gradientUnits="userSpaceOnUse" x1="2.8613" y1="17.0674" x2="17.7773" y2="17.0674">
+<stop offset="0" style="stop-color:#2387B8"/>
+<stop offset="0.0123" style="stop-color:#2387B8"/>
+<stop offset="0.1296" style="stop-color:#2387B8"/>
+<stop offset="0.2842" style="stop-color:#2268A8"/>
+<stop offset="0.4843" style="stop-color:#204798"/>
+<stop offset="0.6755" style="stop-color:#1F2F8C"/>
+<stop offset="0.8521" style="stop-color:#1E2085"/>
+<stop offset="1" style="stop-color:#1E1B82"/>
+</linearGradient>
+<path fill="url(#XMLID_6_)" d="M2.861,15.783v1.998c0,0.314,0.254,0.57,0.568,0.57h13.781c0.313,0,0.566-0.252,0.566-0.57v-1.998    H2.861z"/>
+<polygon fill="#F4A816" points="6.768,16.06 4.992,14.148 15.646,14.148 13.869,16.06   "/>
+<polygon fill="#FFFFFF" points="10.912,13.511 10.912,8.415 6.174,13.511   "/>
+<polygon fill="#FFFFFF" points="11.504,8.415 14.463,13.511 11.504,13.511   "/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M9.836,2.122H8.623c0,0,0,0.719,0,1.011c-0.652,0-3.536,0-3.536,0c-0.839,0-1.522,0.711-1.522,1.584v7.351    c0,0.874,0.684,1.584,1.522,1.584H9.73c0.839,0,1.521-0.71,1.521-1.584V4.717c-0.002-0.68-0.422-1.24-1.013-1.461    c0-0.299,0-1.134,0-1.134H9.836z"/>
+<path d="M9.836,3.549V2.526H9.027v1.011h-3.94c-0.617,0-1.118,0.53-1.118,1.18v7.351c0,0.65,0.501,1.18,1.118,1.18H9.73    c0.615,0,1.117-0.529,1.117-1.18V4.717C10.846,4.103,10.4,3.607,9.836,3.549z"/>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="3.8242" y1="5.3857" x2="10.9917" y2="11.4">
+<stop offset="0" style="stop-color:#3CB4FF"/>
+<stop offset="0.0085" style="stop-color:#3CB4FF"/>
+<stop offset="0.2979" style="stop-color:#278ED8"/>
+<stop offset="0.7697" style="stop-color:#004A91"/>
+<stop offset="1" style="stop-color:#002B5D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M9.729,4.145H5.087c-0.28,0-0.511,0.256-0.511,0.572v7.351c0,0.315,0.23,0.573,0.511,0.573H9.73    c0.281,0,0.511-0.258,0.511-0.573V4.717C10.239,4.4,10.012,4.145,9.729,4.145z"/>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="5.125" y1="5.2637" x2="9.6913" y2="9.0953">
+<stop offset="0" style="stop-color:#C5FDFD"/>
+<stop offset="0.0337" style="stop-color:#C5FDFD"/>
+<stop offset="0.2186" style="stop-color:#C1FAFD"/>
+<stop offset="0.4215" style="stop-color:#B3F3FD"/>
+<stop offset="0.633" style="stop-color:#9DE7FD"/>
+<stop offset="0.849" style="stop-color:#7FD6FD"/>
+<stop offset="1" style="stop-color:#65C7FD"/>
+</linearGradient>
+<rect x="5.385" y="4.954" fill="url(#XMLID_8_)" width="4.047" height="4.45"/>
+</g>
+<rect fill="none" width="21" height="21"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/s60_device.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<g>
+	<rect x="3.208" y="2.854" fill="none" width="44" height="44"/>
+	<path opacity="0.15" d="M32.209,44.854h-14c-2.205,0-4-1.795-4-4v-26c0-2.205,1.795-4,4-4h11.149l1.914-5.912
+		c0.132-0.406,0.504-0.685,0.931-0.693c0.007,0,0.013,0,0.019,0c0.42,0,0.795,0.26,0.94,0.654l2.57,6.975l6.971,0.013
+		c0.42,0,0.795,0.264,0.938,0.658c0.144,0.396,0.024,0.838-0.297,1.108l-5.543,4.658l1.86,6.666c0.113,0.402-0.037,0.83-0.373,1.076
+		c-0.176,0.129-0.383,0.193-0.59,0.193c-0.19,0-0.383-0.054-0.549-0.164l-1.941-1.275v16.042
+		C36.208,43.059,34.413,44.854,32.209,44.854L32.209,44.854z"/>
+	<path opacity="0.5" d="M36.663,17.962l6.036-5.071l-7.667-0.014L32.224,5.25l-2.138,6.604H18.208c-1.654,0-3,1.346-3,3v26
+		c0,1.654,1.346,3,3,3h14c1.654,0,3-1.346,3-3V22.956l3.489,2.294L36.663,17.962z"/>
+	
+		<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="142.6875" y1="-59.4478" x2="142.6875" y2="-101.7325" gradientTransform="matrix(1 0 0 -1 -117.4805 -52.0195)">
+		<stop  offset="0" style="stop-color:#3687FF"/>
+		<stop  offset="1" style="stop-color:#051F7D"/>
+	</linearGradient>
+	<path fill="url(#SVGID_1_)" d="M32.208,10.854h-14c-1.654,0-3,1.346-3,3v26c0,1.654,1.346,3,3,3h14c1.654,0,3-1.346,3-3v-26
+		C35.208,12.2,33.862,10.854,32.208,10.854z"/>
+	
+		<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="142.6875" y1="-59.8735" x2="142.6875" y2="-96.8744" gradientTransform="matrix(1 0 0 -1 -117.4805 -52.0195)">
+		<stop  offset="0" style="stop-color:#F2F2F2"/>
+		<stop  offset="0.1364" style="stop-color:#E4EDF0"/>
+		<stop  offset="0.3929" style="stop-color:#C0DFEB"/>
+		<stop  offset="0.7391" style="stop-color:#86C8E3"/>
+		<stop  offset="0.9945" style="stop-color:#57B6DD"/>
+		<stop  offset="1" style="stop-color:#57B6DD"/>
+	</linearGradient>
+	<rect x="18.208" y="14.854" fill="url(#SVGID_2_)" width="14" height="18"/>
+	<polygon fill="#FFFFFF" fill-opacity="0.4" points="18.208,27.889 32.208,20.889 32.208,14.854 18.208,14.854 	"/>
+	
+		<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="142.6875" y1="-87.873" x2="142.6875" y2="-91.873" gradientTransform="matrix(1 0 0 -1 -117.4805 -52.0195)">
+		<stop  offset="0" style="stop-color:#FFFFFF"/>
+		<stop  offset="1" style="stop-color:#B2B2B2"/>
+	</linearGradient>
+	<rect x="23.208" y="35.854" fill="url(#SVGID_3_)" width="4" height="4"/>
+	<path fill="#FFFFFF" fill-opacity="0.25" d="M33.62,12.442l0.709-0.708c-0.544-0.544-1.294-0.88-2.121-0.88h-14
+		c-1.654,0-3,1.346-3,3v26c0,0.828,0.336,1.578,0.879,2.121l0.709-0.707c-0.363-0.363-0.588-0.863-0.588-1.414v-26c0-1.1,0.9-2,2-2
+		h14C32.758,11.854,33.258,12.079,33.62,12.442z"/>
+	<path fill-opacity="0.2" d="M34.317,11.724l-0.717,0.7c0.373,0.365,0.607,0.869,0.607,1.43v26c0,1.102-0.9,2-2,2h-14
+		c-0.55,0-1.051-0.225-1.412-0.586l-0.709,0.707c0.544,0.543,1.294,0.879,2.121,0.879h14c1.654,0,3-1.346,3-3v-26
+		C35.208,13.022,34.866,12.268,34.317,11.724z"/>
+	<polygon fill="#FFFFFF" fill-opacity="0.2" points="32.208,14.854 32.208,32.854 18.208,32.854 17.208,33.854 33.208,33.854 
+		33.208,13.854 	"/>
+	<polygon fill-opacity="0.25" points="18.208,32.854 18.208,14.854 32.208,14.854 33.208,13.854 17.208,13.854 17.208,33.854 	"/>
+	<path fill="#FFFFFF" fill-opacity="0.2" d="M27.862,35.098l-0.654,0.756v4h-4l-0.771,0.637c0.183,0.221,0.46,0.363,0.771,0.363h4
+		c0.553,0,1-0.449,1-1v-4C28.208,35.553,28.074,35.281,27.862,35.098z"/>
+	<path fill-opacity="0.25" d="M23.208,39.854v-4h4l0.654-0.756c-0.176-0.152-0.404-0.244-0.654-0.244h-4c-0.553,0-1,0.449-1,1v4
+		c0,0.242,0.086,0.463,0.229,0.637L23.208,39.854z"/>
+	<path opacity="0.3" d="M35.166,23.55v-9.701c0-1.654-1.346-3-3-3h-2.324l-0.492,1.522l-7.646,0.014
+		c-0.213,0-0.402,0.134-0.471,0.335c-0.071,0.201-0.006,0.425,0.16,0.557l6.107,4.855l-2.268,6.958
+		c-0.065,0.199,0.002,0.418,0.167,0.548c0.089,0.071,0.199,0.106,0.306,0.106c0.092,0,0.186-0.025,0.268-0.076l6.371-3.977
+		L35.166,23.55z"/>
+	<g>
+		
+			<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-126.7969" y1="301.3916" x2="-126.7969" y2="329.7876" gradientTransform="matrix(1 0 0 1 159.02 -299.4092)">
+			<stop  offset="0" style="stop-color:#FFE23D"/>
+			<stop  offset="1" style="stop-color:#E48717"/>
+		</linearGradient>
+		<polygon fill="url(#SVGID_4_)" points="32.224,4.25 35.032,11.877 42.699,11.891 36.663,16.962 38.697,24.25 32.394,20.105 
+			25.75,24.25 28.125,16.962 21.747,11.891 29.755,11.877 		"/>
+		<path fill-opacity="0.2" d="M29.291,16.611c0,0-2.8-2.227-4.686-3.727c0.001,0,0.002,0,0.004,0l-2.862-0.994l6.378,5.071
+			L29.291,16.611z"/>
+		<path fill-opacity="0.2" d="M42.699,11.891l-2.741,0.998c-1.786,1.5-4.432,3.723-4.432,3.723s0.889,3.184,1.49,5.338
+			c-1.863-1.225-4.609-3.03-4.609-3.03s-2.891,1.804-4.855,3.028c0.002-0.002,0.002-0.004,0.002-0.006L25.75,24.25l6.644-4.145
+			l6.304,4.145l-2.034-7.288L42.699,11.891z"/>
+		<path fill="#FFFFFF" fill-opacity="0.25" d="M42.699,11.891l-7.667-0.014L32.224,4.25l-2.469,7.627l-8.008,0.014l2.862,0.996
+			c2.365-0.005,5.875-0.011,5.875-0.011s1.072-3.317,1.801-5.565c0.83,2.252,2.051,5.565,2.051,5.565s3.361,0.006,5.625,0.011
+			c0,0-0.001,0-0.002,0.002L42.699,11.891z"/>
+		<path fill="#FFFFFF" fill-opacity="0.25" d="M25.75,24.25l1.804-2.309c0.701-2.15,1.737-5.33,1.737-5.33l-1.166,0.351L25.75,24.25
+			z"/>
+	</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/data/videos.svg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 21 21">
+<g>
+<rect fill="none" width="21" height="21"/>
+<g>
+<path fill="#FFFFFF" d="M5.148,3.479C3.885,3.45,2.996,3.83,3.006,5.609v10.113c-0.01,1.748,0.73,2.097,2.143,2.129h10.709    c1.639,0.056,2.142-0.674,2.143-2.129V5.609c-0.001-1.575-0.74-2.159-2.143-2.13H5.148z"/>
+<path fill="url(#XMLID_2_)" d="M17.535,16.263c0,0.645-0.524,1.171-1.17,1.171H4.67c-0.646,0-1.17-0.526-1.17-1.171V5.151    c0-0.645,0.523-1.169,1.17-1.169h11.695c0.646,0,1.17,0.524,1.17,1.169V16.263z"/>
+<rect x="4.67" y="11.586" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="4.67" y="15.095" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="14.611" y="8.076" fill="#FFFFFF" width="1.754" height="1.756"/>
+<rect x="14.611" y="4.567" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="14.611" y="11.586" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="14.611" y="15.095" fill="#FFFFFF" width="1.754" height="1.754"/>
+<rect x="7.594" y="3.982" fill="#CBCBCB" width="5.848" height="3.509"/>
+<rect x="7.594" y="8.66" fill="#CBCBCB" width="5.848" height="4.095"/>
+<rect x="7.594" y="13.925" fill="#CBCBCB" width="5.848" height="3.509"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="3.4541" y1="4.7813" x2="17.5803" y2="16.6345">
+<stop offset="0" style="stop-color:#AFAFAE"/>
+<stop offset="1" style="stop-color:#121212"/>
+</linearGradient>
+</defs>
+</g>
+<rect x="4.653" y="8.07" fill="#FFFFFF" width="1.754" height="1.756"/>
+<rect x="4.653" y="4.562" fill="#FFFFFF" width="1.754" height="1.754"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/eabi/upnptmservertestu.DEF	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS	
+	_Z9LibEntryLv @ 1 NONAME
+        _Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestTimer @ 3 NONAME
+	_ZTI15CDiscoverDevice @ 4 NONAME
+	_ZTI19CDiscoveryTestTimer @ 5 NONAME
+	_ZTV10CTestTimer @ 6 NONAME
+	_ZTV15CDiscoverDevice @ 7 NONAME
+	_ZTV19CDiscoveryTestTimer @ 8 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/group/bld.inf	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,37 @@
+/**
+* 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: 
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_TESTEXPORTS
+../data/TestFramework.ini               /epoc32/winscw/c/TestFramework/TestFramework.ini
+../data/gallery.svg                     /epoc32/winscw/c/upnptmserver/icons/gallery.svg   
+../data/homemedia.svg                   /epoc32/winscw/c/upnptmserver/icons/homemedia.svg
+../data/maps.svg                        /epoc32/winscw/c/upnptmserver/icons/maps.svg  
+../data/music_launched.svg              /epoc32/winscw/c/upnptmserver/icons/music_launched.svg   
+../data/music_unlaunched.svg            /epoc32/winscw/c/upnptmserver/icons/music_unlaunched.svg
+../data/videos.svg                      /epoc32/winscw/c/upnptmserver/icons/videos.svg  
+../data/s60_device.svg                  /epoc32/winscw/c/upnptmserver/icons/s60_device.svg  
+
+PRJ_TESTMMPFILES
+upnptmservertest.mmp
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/group/upnptmservertest.mmp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,52 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MMP file for STIF Test Framework's Hardcoded test module. 
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          upnptmservertest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+
+//TARGETPATH      
+DEFFILE         upnptmservertest.def
+
+USERINCLUDE     ../inc 
+SYSTEMINCLUDE 	/epoc32/include/platform/mw
+
+OS_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          tmservertest.cpp
+SOURCE          tmservertestcases.cpp
+SOURCE          testtimer.cpp 
+SOURCE          discoverytesttimer.cpp
+
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         terminalmodeservice.lib
+LIBRARY         upnpcontrolpointbase.lib
+LIBRARY         upnpserviceframework.lib
+LIBRARY         ecom.lib
+
+LANG            SC
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/group/upnptmservertest.pkg	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,66 @@
+;
+; 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: Installation file for upnptmserver test module
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"\epoc32\winscw\c\upnptmserver\icons\gallery.svg " - "c:\upnptmserver\icons\gallery.svg"
+"\epoc32\winscw\c\upnptmserver\icons\homemedia.svg " - "c:\upnptmserver\icons\homemedia.svg"
+"\epoc32\winscw\c\upnptmserver\icons\maps.svg " -    "c:\upnptmserver\icons\maps.svg"
+"\epoc32\winscw\c\upnptmserver\icons\music_launched.svg " - "c:\upnptmserver\icons\music_launched.svg"
+"\epoc32\winscw\c\upnptmserver\icons\music_unlaunched.svg " - "c:\upnptmserver\icons\music_unlaunched.svg"
+"\epoc32\winscw\c\upnptmserver\icons\videos.svg " - "c:\upnptmserver\icons\videos.svg"
+"\epoc32\winscw\c\upnptmserver\icons\s60_device.svg " - "c:\upnptmserver\icons\s60_device.svg "
+"\epoc32\winscw\c\TestFramework\TestFramework.ini" - "c:\TestFramework\TestFramework.ini"
+"\epoc32\release\armv5\urel\upnptmservertest.dll"   -   "c:\Sys\Bin\upnptmservertest.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/inc/discoverytesttimer.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,46 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CDiscoveryTestTimer class declaration
+*
+*/
+
+
+#ifndef DISCOVERYTESTTIMER_H_
+#define DISCOVERYTESTTIMER_H_
+
+#include <e32base.h>
+#include <e32std.h>
+
+class CTmServerTest; 
+
+class CDiscoveryTestTimer:public CActive
+    {
+public:
+    static CDiscoveryTestTimer* NewL(CTmServerTest& aTmServerTest);
+    ~CDiscoveryTestTimer();
+    void AfterDiscovery(const TInt aDuration);
+    
+private:
+    CDiscoveryTestTimer(CTmServerTest& aTmServerTest);
+    
+private: // From CActive
+    void RunL();
+    void DoCancel();
+
+private:
+    RTimer iDiscoveryTimer;
+    CTmServerTest& iTmServerTest;
+    };
+
+#endif  //DISCOVERYTESTTIMER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/inc/testtimer.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,45 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestTimer class declaration
+*
+*/
+
+#ifndef TESTTIMER_H_
+#define TESTTIMER_H_
+
+#include <e32base.h>
+#include <e32std.h>
+
+class CTmServerTest;
+
+class CTestTimer:public CActive
+    {
+public:
+    static CTestTimer* NewL(CTmServerTest& aTmServerTest);
+    ~CTestTimer();
+    void After(const TInt aDuration);
+    
+private:
+    CTestTimer(CTmServerTest& aTmServerTest);
+    
+private: // From CActive
+    void RunL();
+    void DoCancel();
+
+private:
+    RTimer iTimer;
+    CTmServerTest& iTmServerTest;
+    };
+
+#endif //TESTTIMER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/inc/tmservertest.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,518 @@
+/**
+* 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 TMSERVERTEST_H
+#define TMSERVERTEST_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include "testtimer.h"
+#include "discoverytesttimer.h"
+
+#include <StifLogger.h>
+#include <NormalHardcodedAssert.h>
+#include <upnptmserver.h>
+#include <upnptmserverdeviceinfo.h>
+#include <upnpcontrolpoint.h>
+#include <upnpremotableapp.h>
+#include <upnpterminalmodeicon.h>
+#include <terminalmodeconsts.h>
+#include <upnptmserverobserver.h>
+
+// MACROS
+#define TEST_MODULE_VERSION_MAJOR 0
+#define TEST_MODULE_VERSION_MINOR 0
+#define TEST_MODULE_VERSION_BUILD 0
+
+// Logging path
+_LIT( KTmServerTestLogPath,         "\\logs\\testframework\\upnptmservertest\\" ); 
+// Log file
+_LIT(KTmServerTestLogFile,          "upnptmservertest.txt" ); 
+_LIT(KTmServerTestLogFileWithTitle, "upnptmservertest_[%S].txt" );
+
+const TInt KIconWidth               = 21;
+const TInt KIconHeight              = 21;
+const TInt KIconDepth               = 24;
+const TInt KIconWidth1              = 88;
+const TInt KIconHeight1             = 88;
+const TInt KIconWidth2              = 36;
+const TInt KIconHeight2             = 44;
+const TInt KIconWidth3              = 60;
+const TInt KIconHeight3             = 60;
+const TInt KIconDepth1              = 12;
+const TUint KProfileIdValue         =  0;
+const TUint KAppIdValue             =  1;
+const TUint KAppId1Value            =  2;
+const TUint KAppId2Value            =  3;
+const TUint KAppId3Value            =  4;
+const TUint KAppId4Value            =  5;
+const TUint KAppId5Value            =  6;
+const TUint KNonExistentAppIdValue  =  7;
+const TUint KNonExistentAppId1Value =  8;
+const TUint KInvalidProfileIdValue  =  9;
+const TInt  KInvalidAppIdValue      = -1;
+
+
+#define GETPTR &
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FORWARD DECLARATIONS
+class CTmServerTest;
+
+// DATA TYPES
+// A typedef for function that does the actual testing,
+// function is a type 
+typedef TInt (CTmServerTest::* TestFunction)(TTestResult&);
+
+// CLASS DECLARATION
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+public:
+    const TText*    iCaseName;
+    TestFunction    iMethod;
+    TBool           iIsOOMTest;
+    TInt            iFirstMemoryAllocation;
+    TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+public:
+    TPtrC iCaseName;
+    TestFunction iMethod;
+    TBool           iIsOOMTest;
+    TInt            iFirstMemoryAllocation;
+    TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {
+        };
+
+    };
+
+
+class CDiscoverDevice : public CUpnpControlPoint
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CDiscoverDevice* NewL(CTmServerTest& aTmServerTest);
+
+    /**
+     * Destructor.
+     */
+    virtual ~CDiscoverDevice();
+
+protected:
+    // Functions from base classes
+
+    /**
+     * From CUpnpControlPoint State update handler.
+     */
+    void StateUpdatedL( CUpnpService* aService );
+
+    /**
+     * From CUpnpControlPoint Device discovery handler.
+     */
+    void DeviceDiscoveredL( CUpnpDevice* aDevice );
+
+    /**
+     * From CUpnpControlPoint Device dissappear handler.
+     */
+    void DeviceDisappearedL( CUpnpDevice* aDevice );
+
+    /**
+     * From CUpnpControlPoint Action response handler function.
+     */
+    void ActionResponseReceivedL( CUpnpAction* aAction );
+
+    /**
+     * From CUpnpControlPoint HTTP message handler function.
+     */
+    void HttpResponseReceivedL( CUpnpHttpMessage* aMessage );
+
+            
+    TInt TmServerStateUpdated( CUpnpDevice& aDevice,   CUpnpService*& aService );
+                                                         
+                                                         
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CDiscoverDevice(CTmServerTest& aTmServerTest );
+
+    void ConstructL(); 
+    TInt LaunchAppActionL( TInt aAppId, TInt aProfileId  );
+    TInt TerminateAppActionL( TInt aAppId, TInt aProfileId );
+    TInt GetAppStatusActionL( TInt aAppId );
+    TInt GetAppListActionL(const TDesC8& aAppListFilter ,TInt aProfileId );
+    TInt SetClientProfileActionL(TInt aProfileId, const TDesC8& aClientInfoValue );
+    TInt GetClientProfileActionL(TInt aProfileId );
+    TInt GetMaxNumProfilesActionL();
+    void SubscribeToServiceL();
+        
+public:
+    CTmServerTest&   iTmServerTest;  
+    };
+
+// CLASS DECLARATION
+
+/**
+*  This a TmServerTest class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CTmServerTest) : public CTestModuleBase,
+                                   public MUpnpTmServerObserver
+    {
+public:  // Constructors and destructor
+
+
+    /**
+    * Two-phased constructor.
+    */
+    static CTmServerTest* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CTmServerTest();
+
+public: // New functions
+
+    /**
+    * ?member_description.
+    * @since ?Series60_version
+    * @param ?arg1 ?description
+    * @return ?description
+    */
+    //?type ?member_function( ?type ?arg1 );
+    TInt StartTmServerDeviceL ( TTestResult& aResult );
+    TInt PublishTmServerServiceL ( TTestResult& aResult );
+    TInt StopTmServerDeviceL ( TTestResult& aResult );
+    TInt ReStartTmServerDeviceL( TTestResult& aResult );
+    TInt UnRegisterAppL(  TTestResult& aResult  );
+    TInt UnRegisterAppsL(  TTestResult& aResult  );
+    TInt RegisterDuplicateAppL(  TTestResult& aResult  );
+    TInt RegisterDuplicateAppsL(  TTestResult& aResult  );
+    TInt UnRegisterUnRegisteredAppL ( TTestResult& aResult  );
+    TInt UnRegisterUnRegisteredAppsL ( TTestResult& aResult  );   
+    TInt HandleLaunchAppActionL ( TTestResult& aResult );
+    TInt HandleInvalidAppIdLaunchAppActionL(TTestResult& aResult );     
+    TInt HandleInvalidProfileIdLaunchAppActionL(TTestResult& aResult );   
+    TInt HandleNonExistentLaunchAppActionL (TTestResult& aResult);
+    TInt HandleUnauthorizedLaunchAppActionL (TTestResult& aResult);  
+    TInt HandleDeviceLockedLaunchAppActionL (TTestResult& aResult); 
+    TInt HandleTerminateAppActionL ( TTestResult& aResult );
+    TInt HandleNonExistentTerminateAppActionL( TTestResult& aResult );
+    TInt HandleInvalidAppIdTerminateAppActionL( TTestResult& aResult );
+    TInt HandleInvalidProfileIdTerminateAppActionL( TTestResult& aResult );
+    TInt HandleUnauthorizedTerminateAppActionL ( TTestResult& aResult );   
+    TInt HandleDeviceLockedTerminateAppActionL ( TTestResult& aResult );
+    TInt HandleGetAppListActionFilter1L(TTestResult& aResult );
+    TInt HandleGetAppListActionFilter2L(TTestResult& aResult );
+    TInt HandleGetAppListActionFilter3L(TTestResult& aResult );
+    TInt HandleGetAppListActionFilter4L(TTestResult& aResult );
+    TInt HandleGetAppListActionInvalidArg1L(TTestResult& aResult );
+    TInt HandleGetAppListActionInvalidArg2L(TTestResult& aResult );
+    TInt HandleGetAppListActionInvalidArg3L(TTestResult& aResult );  
+    TInt HandleGetAppListActionInvalidArg4L(TTestResult& aResult );
+    TInt HandleGetAppListActionInvalidArg5L(TTestResult& aResult );
+    TInt HandleInvalidProfileIdGetAppListActionL ( TTestResult& aResult );
+    TInt HandleGetAppListActionOperationRejectedL ( TTestResult& aResult );
+    TInt HandleGetAppListActionNoFilterL ( TTestResult& aResult );
+    TInt HandleGetAppStatusActionL( TTestResult& aResult );
+    TInt HandleWildcardGetAppStatusActionL( TTestResult& aResult );
+    TInt HandleInvalidAppIdGetAppStatusActionL ( TTestResult& aResult );
+    TInt HandleNonExistentGetAppStatusActionL ( TTestResult& aResult );   
+    TInt HandleSetClientProfileActionL( TTestResult& aResult );
+    TInt HandleInvalidProfileIdSetClientProfileActionL (TTestResult& aResult ); 
+    TInt HandleInvalidProfileSetClientProfileActionL (TTestResult& aResult );   
+    TInt HandleDeviceLockedSetClientProfileActionL (TTestResult& aResult );  
+    TInt HandleResourceBusySetClientProfileActionL (TTestResult& aResult ); 
+    TInt HandleGetClientProfileActionL( TTestResult& aResult );
+    TInt HandleInvalidProfileIdGetClientProfileActionL (TTestResult& aResult );
+    TInt HandleGetMaxNumProfilesActionL( TTestResult& aResult );
+    TInt HandleGetMaxNumProfilesOperationRejectedL ( TTestResult& aResult );
+    TInt HandleEventAppStatusUpdateL ( TTestResult& aResult );
+    TInt HandleEventAppListUpdateL ( TTestResult& aResult );
+    TInt HandleEventDuplicateAppStatusUpdateL(  TTestResult& aResult  );  
+    TInt HandleEventProfileIdListStatusUpdateL(  TTestResult& aResult  );
+    
+    void RegisterApplicationsL(CUpnpTmServer& aTmServer );  
+    void SetTmServerSettingsL();
+    void TestTimerTimedOutL(); 
+    void TestTimerDiscoveryTimedOut(); 
+    void DeviceVerified();
+    void DeviceLostVerified();
+    void ServiceVerified();
+
+public: // methods from MUpnpTmServerObserver
+    TTerminalModeErrorCode OnGetApplicationList( TUint aProfileId );
+    TTerminalModeErrorCode OnLaunchApp( TUint aAppId, RBuf8& aUrl, TUint aProfileId );
+    TTerminalModeErrorCode OnTerminateApp( TUint aAppId, TUint aProfileId );
+    TTerminalModeErrorCode OnGetAppStatus( TUint aAppId, TUint& aProfileId ,RBuf8& aStatusType );
+    TTerminalModeErrorCode OnGetMaxNumProfiles( TUint& aProfileIdCount );
+    TTerminalModeErrorCode OnSetClientProfile( TUint aProfileId, const TDesC8& aClientProfile,RBuf8& aResultProfile ); 
+    TTerminalModeErrorCode OnGetClientProfile( TUint aProfileId, RBuf8& aClientProfile );            
+    const CUpnpTmClientIconPref& GetClientIconPrefsL( TUint aProfileId );
+
+public: // Functions from base classes
+
+    /**
+    * From CTestModuleBase InitL is used to initialize the 
+    *       TmServerTest. It is called once for every instance of 
+    *       TestModuleTmServerTest after its creation.
+    * @since ?Series60_version
+    * @param aIniFile Initialization file for the test module (optional)
+    * @param aFirstTime Flag is true when InitL is executed for first 
+    *               created instance of TmServerTest.
+    * @return Symbian OS error code
+    */
+    TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+    /**
+    * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+    *   from TmServerTest. 
+    * @since ?Series60_version
+    * @param aTestCaseFile Test case file (optional)
+    * @param aTestCases  Array of TestCases returned to test framework
+    * @return Symbian OS error code
+    */
+    TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                        RPointerArray<TTestCaseInfo>& aTestCases );
+
+    /**
+    * From CTestModuleBase RunTestCaseL is used to run an individual 
+    *   test case. 
+    * @since ?Series60_version
+    * @param aCaseNumber Test case number
+    * @param aTestCaseFile Test case file (optional)
+    * @param aResult Test case result returned to test framework (PASS/FAIL)
+    * @return Symbian OS error code (test case execution error, which is 
+    *           not reported in aResult parameter as test case failure).
+    */   
+    TInt RunTestCaseL( const TInt aCaseNumber, 
+                       const TFileName& aTestCaseFile,
+                       TTestResult& aResult );
+
+    /**
+    * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+    * test case going to be executed using OOM conditions
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @param aFailureType OOM failure type (optional)
+    * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+    * @param aLastMemFailure The last heap memory allocation failure value (optional)
+    * @return TBool
+    */
+    virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                 const TInt /* aCaseNumber */, 
+                                 TOOMFailureType& aFailureType, 
+                                 TInt& /* aFirstMemFailure */, 
+                                 TInt& /* aLastMemFailure */ );
+
+    /**
+    * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+    * test environment
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @return None
+    */
+    virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ ); 
+
+    /**
+    * From CTestModuleBase; OOMHandleWarningL
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @param aFailNextValue FailNextValue for OOM test execution (optional)
+    * @return None
+    *
+    * User may add implementation for OOM test warning handling. Usually no
+    * implementation is required.           
+    */
+    virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                    const TInt /* aCaseNumber */, 
+                                    TInt& /* aFailNextValue */); 
+
+    /**
+    * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+    * test environment
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @return None
+    *
+    */
+    virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                   const TInt /* aCaseNumber */ );
+    
+    /**
+     * Method used to log version of test module
+     */
+    void SendTestModuleVersion();
+
+protected:  // New functions
+
+    /**
+    * ?member_description.
+    * @since ?Series60_version
+    * @param ?arg1 ?description
+    * @return ?description
+    */
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CTmServerTest();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    // Prohibit copy constructor if not deriving from CBase.
+    // ?classname( const ?classname& );
+    // Prohibit assigment operator if not deriving from CBase.
+    // ?classname& operator=( const ?classname& );
+
+    /**
+    * Function returning test case name and pointer to test case function.
+    * @since ?Series60_version
+    * @param aCaseNumber test case number
+    * @return TCaseInfo 
+    */
+    const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+    /**
+    * [test case declarations] - do not remove
+    */
+    //ADD NEW METHOD DEC HERE"
+
+    /**
+    * Printing test case.
+    * @since ?Series60_version
+    * @param aResult Test case result (PASS/FAIL)
+    * @return Symbian OS error code (test case execution error 
+    *   that is not returned as test case result in aResult)
+    */
+    TInt PrintTest( TTestResult& aResult );
+
+    /**
+    * Printing loop test case.
+    * @since ?Series60_version
+    * @param aResult Test case result (PASS/FAIL)
+    * @return Symbian OS error code (test case execution error 
+    *   that is not returned as test case result in aResult)
+    */
+    TInt LoopTest( TTestResult& aResult );
+        
+       
+
+public:     // Data
+    // ?one_line_short_description_of_data
+    //?data_declaration;
+    TBool                              iTmServerDeviceType;
+    TBool                              iTmServerServiceType;
+           
+protected:  // Data
+    // ?one_line_short_description_of_data
+    //?data_declaration;
+        
+public:
+    TBool                              iGetAppList;
+    TBool                              iStartApp;
+    TBool                              iStopApp;
+    TBool                              iSetClientProfile;
+    TBool                              iGetClientProfile;
+    TBool                              iGetMaxNumProfiles;
+    TBool                              iGetAppStatus;
+    TBool                              iStatusNotified;
+    TBool                              iOperationRejected;
+    TBool                              iResourceBusy;
+       
+        
+private:    // Data
+    // Pointer to test (function) to be executed
+    TestFunction iMethod;
+
+    // Pointer to logger
+    CStifLogger * iLog; 
+
+    // Normal logger
+    CStifLogger* iStdLog;
+
+    // Test case logger
+    CStifLogger* iTCLog;
+
+    // Flag saying if test case title should be added to log file name
+    TBool iAddTestCaseTitleToLogName;
+
+    // Flag saying if version of test module was already sent
+    TBool iVersionLogged;
+
+private:    
+    CUpnpTmServer*                       iTmServer;
+    CDiscoverDevice*                     iSearchDevice;
+    CTestTimer*                          iTestTimer;
+    CDiscoveryTestTimer*                 iDiscoveryTestTimer;
+    CUpnpRemotableApp*                   iRemotableApp;
+    CUpnpTerminalModeIcon*               iTerminalModeIcon;
+    CUpnpRemotableApp*                   iRemotableApp1;
+    CUpnpRemotableApp*                   iRemotableApp2;
+    CUpnpRemotableApp*                   iRemotableApp3;
+    CUpnpRemotableApp*                   iRemotableApp4;  
+    CUpnpRemotableApp*                   iRemotableApp5;           
+    CUpnpTmServerDeviceInfo*             iTmServerDeviceInfo;
+    RPointerArray<CUpnpRemotableApp>     iRemotableAppArray;  
+    TBool                                iDeviceVerified;
+    TBool                                iDeviceLostVerified;
+    TBool                                iServiceVerified;
+    RPointerArray<CUpnpTmClientIconPref> iClientIconPrefArray;
+    };
+
+#endif      // TMSERVERTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/src/discoverytesttimer.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,58 @@
+/**
+* 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: 
+*
+*/
+
+
+// INCLUDE FILES
+#include "discoverytesttimer.h"
+#include "tmservertest.h"
+
+const TInt KMicroSecond1 = 1000000;
+
+CDiscoveryTestTimer* CDiscoveryTestTimer::NewL(CTmServerTest& aTmServerTest)
+    {
+    return new (ELeave) CDiscoveryTestTimer(aTmServerTest);  
+    }
+
+CDiscoveryTestTimer::~CDiscoveryTestTimer()
+    {
+    Cancel();
+    iDiscoveryTimer.Close(); 
+    }
+
+void CDiscoveryTestTimer::AfterDiscovery(const TInt aDuration)
+    {
+    iDiscoveryTimer.After(iStatus, aDuration*KMicroSecond1);
+    SetActive();    
+    }
+
+CDiscoveryTestTimer::CDiscoveryTestTimer(CTmServerTest& aTmServerTest)
+:CActive(EPriorityStandard), iTmServerTest(aTmServerTest)
+    {
+    CActiveScheduler::Add(this);
+    iDiscoveryTimer.CreateLocal();   
+    }
+
+void CDiscoveryTestTimer::RunL()
+    {
+     iTmServerTest.TestTimerDiscoveryTimedOut();
+    }
+
+void CDiscoveryTestTimer::DoCancel()
+    {
+    iDiscoveryTimer.Cancel();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/src/testtimer.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,58 @@
+/**
+* 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: 
+*
+*/
+
+
+// INCLUDE FILES
+#include "testtimer.h"
+#include "tmservertest.h"
+
+const TInt KMicroSecond = 1000000;
+
+CTestTimer* CTestTimer::NewL(CTmServerTest& aTmServerTest)
+    {
+    return new (ELeave) CTestTimer(aTmServerTest);  
+    }
+
+CTestTimer::~CTestTimer()
+    {
+    Cancel();
+    iTimer.Close(); 
+    }
+
+void CTestTimer::After(const TInt aDuration)
+    {
+    iTimer.After(iStatus, aDuration*KMicroSecond);
+    SetActive();    
+    }
+
+CTestTimer::CTestTimer(CTmServerTest& aTmServerTest)
+:CActive(EPriorityStandard), iTmServerTest(aTmServerTest)
+    {
+    CActiveScheduler::Add(this);
+    iTimer.CreateLocal();   
+    }
+
+void CTestTimer::RunL()
+    {
+     iTmServerTest.TestTimerTimedOutL();
+    }
+
+void CTestTimer::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/src/tmservertest.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,462 @@
+/**
+* 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: 
+*
+*/
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "tmservertest.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::CTmServerTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+
+CTmServerTest::CTmServerTest()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+//
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CTmServerTest::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+
+    iStdLog = CStifLogger::NewL( KTmServerTestLogPath, 
+                          KTmServerTestLogFile,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          ETrue,
+                          ETrue,
+                          ETrue,
+                          EFalse,
+                          ETrue,
+                          ETrue/*,
+                          100 */);
+    iLog = iStdLog;
+    iVersionLogged = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTmServerTest* CTmServerTest::NewL()
+    {
+    CTmServerTest* self = new (ELeave) CTmServerTest;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CTmServerTest::~CTmServerTest()
+    {
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CTmServerTest::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CTmServerTest::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+
+        // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+
+        // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended 
+        // successfully the TTestCaseInfo object is owned (and freed) 
+        // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CTmServerTest::RunTestCaseL( 
+    const TInt aCaseNumber,   
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    if(!iVersionLogged)
+        {
+        SendTestModuleVersion();
+        iVersionLogged = ETrue;
+        }
+    
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogStartTC, "Starting testcase [%S]" );
+    iLog->Log( KLogStartTC, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        //Open new log file with test case title in file name
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Delete test case logger if exists
+            if(iTCLog)
+                {
+                delete iTCLog;
+                iTCLog = NULL;
+                }
+
+            TFileName logFileName;
+            TName title;
+            TestModuleIf().GetTestCaseTitleL(title);
+        
+            logFileName.Format(KTmServerTestLogFileWithTitle, &title);
+
+            iTCLog = CStifLogger::NewL(KTmServerTestLogPath, 
+                                        logFileName,
+                                        CStifLogger::ETxt,
+                                        CStifLogger::EFile,
+                                        ETrue,
+                                        ETrue,
+                                        ETrue,
+                                        EFalse,
+                                        ETrue,
+                                        ETrue/*,
+                                        100*/);
+            iLog = iTCLog;                                       
+            }
+        CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
+        CActiveScheduler::Install( activeScheduler );
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        //execStatus  = ( this->*iMethod )( aResult );
+        TRAPD(err, execStatus  = ( this->*iMethod )( aResult ));
+        delete activeScheduler;
+        if(iAddTestCaseTitleToLogName)
+            {
+            //Restore standard log and destroy test case logger
+            iLog = iStdLog;
+            delete iTCLog; //Close test case log
+            iTCLog = NULL;
+            }
+        User::LeaveIfError(err);
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+// -----------------------------------------------------------------------------
+//
+TBool CTmServerTest::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt aCaseNumber, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& aFirstMemFailure, 
+                                TInt& aLastMemFailure ) 
+    {
+    _LIT( KLogOOMTestQueryL, "CTmServerTest::OOMTestQueryL" );
+    iLog->Log( KLogOOMTestQueryL );     
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: User may add implementation for OOM test environment initialization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CTmServerTest::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    _LIT( KLogInfo, "CTmServerTest::OOMTestInitializeL" );
+    iLog->Log( KLogInfo ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: User may add implementation for OOM test warning handling. Usually no
+// implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CTmServerTest::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    _LIT( KLogInfo, "CTmServerTest::OOMHandleWarningL" );
+    iLog->Log( KLogInfo );
+    }
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: User may add implementation for OOM test environment finalization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CTmServerTest::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    _LIT( KLogInfo, "CTmServerTest::OOMTestFinalizeL" );
+    iLog->Log( KLogInfo );
+    }
+
+//-----------------------------------------------------------------------------
+// CTmServerTest::SendTestModuleVersion
+// Method used to send version of test module
+//-----------------------------------------------------------------------------
+
+void CTmServerTest::SendTestModuleVersion()
+    {
+    TVersion moduleVersion;
+    moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
+    moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
+    moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
+    
+    TFileName moduleName;
+    moduleName = _L("upnptmservertest.dll");
+
+    TBool newVersionOfMethod = ETrue;
+    TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CTmServerTest::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice/tsrc/upnptmservertest/src/tmservertestcases.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,3748 @@
+/**
+* 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: 
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <ecom/ecom.h>
+#include <upnpdevice.h>
+#include <upnptmserverdeviceinfo.h>
+#include <upnpsettings.h>
+#include "testtimer.h"
+#include "discoverytesttimer.h"
+#include "tmservertest.h"
+
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8(KTestSvgMimeType,           "image/svg+xml");
+_LIT8(KTmServerDevice,            "urn:schemas-upnp-org:device:TmServerDevice:1" );
+_LIT8(KTmServerService,           "urn:schemas-upnp-org:service:TmApplicationServer:1" );
+_LIT8(KTmServerServiceType,       "TmApplicationServer:1" );
+_LIT8(KTmServerServiceType1,      "TmClientProfile:1" );
+_LIT8(KBtMacValue,                "00257df016d5");
+_LIT8(KArgTypeAppStatusUpdate,    "AppStatusUpdate");
+_LIT8(KGetAppStatus,              "GetApplicationStatus");
+_LIT8(KAppStatus,                 "AppStatus");
+_LIT8(KGetApplicationList,        "GetApplicationList");
+_LIT8(KAppListing,                "AppListing");
+_LIT8(KLaunchApp,                 "LaunchApplication");
+_LIT8(KTerminateApp,              "TerminateApplication");
+_LIT8(KAppLaunchStatus,           "AppURI");
+_LIT8(KAppTerminateStatus,        "TerminationResult");
+_LIT8(KAppId ,                    "AppID");
+_LIT8(KAppFilter,                 "AppListingFilter");
+_LIT8(KResultProfile ,            "resultProfile");
+_LIT8(KSetClientProfile ,         "SetClientProfile");
+_LIT8(KGetClientProfile,          "GetClientProfile");
+_LIT8(KGetMaxNumProfiles,         "GetMaxNumProfiles");
+_LIT8(KClientProfile ,            "clientProfile");
+_LIT8(KNumProfilesAllowed ,       "numProfilesAllowed");
+_LIT8(KProfileId,                 "ProfileID");
+_LIT8(KProfileId1,                "profileID");
+_LIT8(KBackground,                "Background");
+_LIT8(KForeground,                "Foreground");
+_LIT8(KAppListFilterValue1,       "\"icon@mimetype=\"*svg+xml*\",icon@width=\"*\",icon@height=\"*\",icon@depth=\"*\"\"");
+_LIT8(KAppListFilterValue2,       "\"name=\"*nav*\",description=\"*\",appInfo@appCategory=\"*\",appInfo@trustLevel=\"*\",displayInfo@contentCategory=\"*\",displayInfo@contentRules=\"*\",displayInfo@trustLevel=\"*\",allowedProfileIDs=\"*\"\"");
+_LIT8(KAppListFilterValue3,       "\"name=\"*bluetooth*\",description=\"*\",icon@mimetype=\"*svg+xml*\",remotingInfo@protocolID=\"*\",remotingInfo@direction=\"*\",appInfo@appCategory=\"*\",audioInfo@audioType=\"*\",resourceStatus=\"free\",signature=\"*\"\"");
+_LIT8(KAppListFilterValue4,       "\"name=\"*\",description=\"*Audio*\",icon@mimetype=\"*svg+xml*\",remotingInfo@protocolID=\"*\",remotingInfo@format=\"*\",appInfo@appCategory=\"*\",audioInfo@audioType=\"*\",resourceStatus=\"free\",signature=\"*\"\"");
+_LIT8(KWildCard,                  "*");
+_LIT(KIconPathMusicUnLaunched,          "c:\\upnptmserver\\icons\\music_unlaunched.svg");
+_LIT(KIconPathMusicLaunched,            "c:\\upnptmserver\\icons\\music_launched.svg");
+_LIT(KIconPathMaps,                     "c:\\upnptmserver\\icons\\maps.svg");
+_LIT(KIconPathBtA2DpUnLaunched,         "c:\\upnptmserver\\icons\\gallery.svg");
+_LIT(KIconPathBtA2DpLaunched,           "c:\\upnptmserver\\icons\\homemedia.svg");
+_LIT(KIconPathBtHfp,                    "c:\\upnptmserver\\icons\\videos.svg");
+_LIT(KIconDevicePath,                   "c:\\upnptmserver\\icons\\s60_device.svg");    
+_LIT8(KDeviceInfo,                      "<X_Nokia_deviceInfo><version><major>1</major><minor>0</minor></version><mtp_tc>true</mtp_tc>"
+    "<license_model>pre,post</license_model><sound_feedback><enabled>true</enabled></sound_feedback><ipRouting><enabled>false</enabled></ipRouting>"
+    "</X_Nokia_deviceInfo>");
+
+_LIT8(KClientProfileInfo, "&lt;clientProfile&gt;&lt;clientID&gt;Cl_1&lt;/clientID&gt;&lt;friendlyName&gt;Client One&lt;/friendlyName&gt;&lt;manufacturer&gt;man_2&lt;/manufacturer&gt;&lt;modelName&gt;CL_Model2&lt;/modelName&gt;&lt;modelNumber&gt;2009&lt;/modelNumber&gt;&lt;iconPreference&gt;&lt;width&gt;240&lt;/width&gt;&lt;height&gt;240&lt;/height&gt;&lt;/iconPreference&gt;&lt;contentRules&gt;&lt;rule&gt;&lt;ruleId&gt;0&lt;/ruleId&gt;&lt;ruleValue&gt;0.1&lt;/ruleValue&gt;&lt;/rule&gt;&lt;rule&gt;&lt;ruleId&gt;1&lt;/ruleId&gt;&lt;/rule&gt;&lt;/contentRules&gt;&lt;/clientProfile&gt;");
+
+_LIT8(KDeviceLockedClientProfile, "&lt;clientProfile&gt;&lt;clientID&gt;Cl_2&lt;/clientID&gt;&lt;/clientProfile&gt;");
+
+_LIT8(KXmlSignature, "&lt;Signature Id= &quot;AppListSignature&quot; xmlns=&quot;http://www.w3.org/2000/09/xmldsig#&quot;&gt; &lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm=&quot;http://www.w3.org/2006/12/xml-c14n11&quot;/&gt;&lt;SignatureMethodAlgorithm=&quot;http://www.w3.org/2000/09/xmldsig#dsa-sha1&quot;/&gt; &lt;Reference URI=&quot;&quot;&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;/Signature&gt;");
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTmServerTest::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo CTmServerTest::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    TmServerTest.cpp file and to TmServerTest.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // [test cases entries] - do not remove
+        
+        ENTRY( "Start TM Server Device", CTmServerTest::StartTmServerDeviceL ),
+        ENTRY( "Publish TM Server Service", CTmServerTest::PublishTmServerServiceL ),
+        ENTRY( "Stop TM Server Device", CTmServerTest::StopTmServerDeviceL ),
+        ENTRY( "ReStart TM Server Device", CTmServerTest::ReStartTmServerDeviceL ),         
+        ENTRY( "Handle LaunchApp Command", CTmServerTest::HandleLaunchAppActionL ),
+        ENTRY( "Handle Invalid AppId LaunchApp Command", CTmServerTest::HandleInvalidAppIdLaunchAppActionL ),
+        ENTRY( "Handle Invalid ProfileId LaunchApp Command", CTmServerTest::HandleInvalidProfileIdLaunchAppActionL ),
+        ENTRY( "Handle LaunchApp Command For Non-Existent AppID", CTmServerTest::HandleNonExistentLaunchAppActionL ),
+        ENTRY( "Handle LaunchApp Command For UnAuthorized AppID", CTmServerTest::HandleUnauthorizedLaunchAppActionL ),
+        ENTRY( "Handle Device Locked Condition For LaunchApp Command", CTmServerTest::HandleDeviceLockedLaunchAppActionL ),
+        ENTRY( "Handle TerminateApp Command", CTmServerTest::HandleTerminateAppActionL),
+        ENTRY( "Handle TerminateApp Command For Non-Existent AppID", CTmServerTest::HandleNonExistentTerminateAppActionL),
+        ENTRY( "Handle Invalid AppId TerminateApp Command", CTmServerTest::HandleInvalidAppIdTerminateAppActionL),
+        ENTRY( "Handle Invalid ProfileId TerminateApp Command", CTmServerTest::HandleInvalidProfileIdTerminateAppActionL),
+        ENTRY( "Handle TerminateApp Command For UnAuthorized AppID", CTmServerTest::HandleUnauthorizedTerminateAppActionL),
+        ENTRY( "Handle Device Locked Condition For TerminateApp Command", CTmServerTest::HandleDeviceLockedTerminateAppActionL ),
+        ENTRY( "Handle GetAppStatus Command ", CTmServerTest::HandleGetAppStatusActionL ),
+        ENTRY( "Handle GetAppStatus Command For All the Applications", CTmServerTest::HandleWildcardGetAppStatusActionL ),
+        ENTRY( "Handle GetAppStatus Command For Invalid AppId", CTmServerTest::HandleInvalidAppIdGetAppStatusActionL ),
+        ENTRY( "Handle GetAppStatus Command For Non-Existent AppID", CTmServerTest::HandleNonExistentGetAppStatusActionL ),
+        ENTRY( "Handle GetAppList Command with Filter1", CTmServerTest:: HandleGetAppListActionFilter1L ), 
+        ENTRY( "Handle GetAppList Command with Filter2", CTmServerTest:: HandleGetAppListActionFilter2L ),
+        ENTRY( "Handle GetAppList Command with Filter3", CTmServerTest:: HandleGetAppListActionFilter3L ),  
+        ENTRY( "Handle GetAppList Command with Filter4", CTmServerTest:: HandleGetAppListActionFilter4L ), 
+        ENTRY( "Handle GetAppList Command with No Filter", CTmServerTest:: HandleGetAppListActionNoFilterL ), 
+        ENTRY( "Handle GetAppList Command with Invalid Arg1", CTmServerTest:: HandleGetAppListActionInvalidArg1L ), 
+        ENTRY( "Handle GetAppList Command with Invalid Arg2", CTmServerTest:: HandleGetAppListActionInvalidArg2L ),
+        ENTRY( "Handle GetAppList Command with Invalid Arg3", CTmServerTest:: HandleGetAppListActionInvalidArg3L ),
+        ENTRY( "Handle GetAppList Command with Invalid Arg4", CTmServerTest:: HandleGetAppListActionInvalidArg4L ),
+        ENTRY( "Handle GetAppList Command with Invalid Arg5", CTmServerTest:: HandleGetAppListActionInvalidArg5L ),
+        ENTRY( "Handle Invalid ProfileId GetAppList Command", CTmServerTest:: HandleInvalidProfileIdGetAppListActionL),
+        ENTRY( "Handle Operation Rejected Condition For GetAppList Command", CTmServerTest:: HandleGetAppListActionOperationRejectedL), 
+        ENTRY( "Handle SetClientProfile Command", CTmServerTest:: HandleSetClientProfileActionL ),  
+        ENTRY( "Handle Invalid ProfileId SetClientProfile Command", CTmServerTest:: HandleInvalidProfileIdSetClientProfileActionL ), 
+        ENTRY( "Handle Invalid Profile SetClientProfile Command", CTmServerTest:: HandleInvalidProfileSetClientProfileActionL ),
+        ENTRY( "Handle Device Locked Condition For SetClientProfile Command", CTmServerTest:: HandleDeviceLockedSetClientProfileActionL ),
+        ENTRY( "Handle Resource Busy Condition For SetClientProfile Command", CTmServerTest:: HandleResourceBusySetClientProfileActionL ),
+        ENTRY( "Handle GetClientProfile Command", CTmServerTest:: HandleGetClientProfileActionL ), 
+        ENTRY( "Handle Invalid ProfileId GetClientProfile Command", CTmServerTest:: HandleInvalidProfileIdGetClientProfileActionL ), 
+        ENTRY( "Handle GetMaxNumProfiles Command", CTmServerTest:: HandleGetMaxNumProfilesActionL ), 
+        ENTRY( "Handle Operation Rejected Condition For GetMaxNumProfiles Command", CTmServerTest:: HandleGetMaxNumProfilesOperationRejectedL ),
+        ENTRY( "Register Duplicate Application", CTmServerTest::RegisterDuplicateAppL),  
+        ENTRY( "Register Duplicate Applications", CTmServerTest::RegisterDuplicateAppsL),       
+        ENTRY( "UnRegister Application", CTmServerTest::UnRegisterAppL),        
+        ENTRY( "UnRegister Multiple Applications", CTmServerTest::UnRegisterAppsL),
+        ENTRY( "UnRegister UnRegistered Application", CTmServerTest::UnRegisterUnRegisteredAppL),
+        ENTRY( "UnRegister Multiple UnRegistered Applications", CTmServerTest::UnRegisterUnRegisteredAppsL),
+        ENTRY( "Handle Event For AppStatus Update", CTmServerTest::HandleEventAppStatusUpdateL ),
+        ENTRY( "Handle Event For AppList Update", CTmServerTest::HandleEventAppListUpdateL ),
+        ENTRY( "Handle Event For Duplicate AppStatus Update", CTmServerTest::HandleEventDuplicateAppStatusUpdateL),
+        ENTRY( "Handle Event For ProfileIdList Status Update", CTmServerTest::HandleEventProfileIdListStatusUpdateL),
+                
+        // OOM Testcases    
+        OOM_ENTRY( "[OOM_StartTmServerDevice]", CTmServerTest::StartTmServerDeviceL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleGetAppListWithFilter]", CTmServerTest:: HandleGetAppListActionFilter1L,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleGetAppListWithoutFilter]", CTmServerTest:: HandleGetAppListActionNoFilterL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleSetClientProfileCommand]", CTmServerTest:: HandleSetClientProfileActionL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleGetAppStatusCommand]", CTmServerTest:: HandleGetAppStatusActionL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleGetAppStatusForAllApplications]", CTmServerTest::HandleWildcardGetAppStatusActionL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleAppStatusUpdateEvent]", CTmServerTest::HandleEventAppStatusUpdateL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_HandleDuplicateAppStatusUpdateEvent]", CTmServerTest::HandleEventDuplicateAppStatusUpdateL,ETrue,1,5 ),
+        OOM_ENTRY( "[OOM_UnRegisterApplications]", CTmServerTest::UnRegisterAppsL,ETrue,1,5 )
+        };
+    
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+    }
+
+
+//========================= TEST CASES =======================================================
+
+TInt CTmServerTest::StartTmServerDeviceL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Start Terminalmode Server Device" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();     
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this );
+    
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer); 
+    
+    // Start the tmserver device and its services
+    iTmServer->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if ( iDeviceVerified)
+        {
+        _LIT( KDescription , "Terminalmode Server Device started successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Start of Terminalmode Server Device Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::PublishTmServerServiceL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Publish Terminalmode server Service" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerServiceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this );
+    
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if ( iServiceVerified)
+        {
+        _LIT( KDescription , "Terminalmode server Service published successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Publishing of Terminalmode server Service Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        } 
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::StopTmServerDeviceL  ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Stop Terminalmode server Device" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this );
+    
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();  
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    if ( iDeviceVerified  )
+        {
+         //Stop the tmserver device and its services
+         iTmServer->StopL(); 
+        }    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();         
+    if ( iDeviceLostVerified )
+        {
+        _LIT( KDescription , "Terminalmode server Device stopped successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Stopping of Terminalmode server Device Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::ReStartTmServerDeviceL ( TTestResult& aResult )
+    {
+   _LIT( KLogInfo, "ReStart Terminalmode server Device" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo,*this );
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);    
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    //Stop the tmserver device and its services
+    iTmServer->StopL();
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();    
+    if ( iDeviceVerified)
+        {
+        _LIT( KDescription , "Terminalmode server Device re-started successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Re-starting of Terminalmode server Device Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }    
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    } 
+
+TInt CTmServerTest::RegisterDuplicateAppL(  TTestResult& aResult  )
+    {   
+    _LIT( KLogInfo, "Register Duplicate Application" );
+    iLog->Log( KLogInfo );
+
+    //Sets the information associated with the terminal mode server device    
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    _LIT8(KAppDesc, "Bluetooth A2DP Audio Server");
+    iRemotableApp = CUpnpRemotableApp::NewL( KAppId2Value ,_L8("Bluetooth A2DP"));
+    iRemotableApp->SetAppDescriptionL(KAppDesc());
+       
+    CUpnpTmInfoElement& tmInfoElement = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement.AddTmInfoElementL(_L8("protocolID"),_L8("BTA2DP"));
+    tmInfoElement.AddTmInfoElementL(_L8("direction"),_L8("out"));
+       
+    CUpnpTmInfoElement& tmInfoElement1 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement1.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000003"));
+    tmInfoElement1.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+       
+    iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpUnLaunched, KIconWidth2, KIconHeight2, KIconDepth1,KTestSvgMimeType)); 
+    iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpLaunched,KIconWidth3, KIconHeight3, KIconDepth1,KTestSvgMimeType));
+    iRemotableApp->SetResourceStatusL(_L8("free"));
+
+    // Register the application 
+    iTmServer->RegisterAppL(iRemotableApp);
+    
+    iRemotableApp1 = CUpnpRemotableApp::NewL( KAppId2Value ,_L8("Bluetooth A2DP"));
+    iRemotableApp1->SetAppDescriptionL(KAppDesc());
+          
+    CUpnpTmInfoElement& tmInfoElement2 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement2.AddTmInfoElementL(_L8("protocolID"),_L8("BTA2DP"));
+    tmInfoElement2.AddTmInfoElementL(_L8("direction"),_L8("out"));
+          
+    CUpnpTmInfoElement& tmInfoElement3 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement3.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000003"));
+    tmInfoElement3.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+          
+    iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpUnLaunched, KIconWidth2, KIconHeight2, KIconDepth1,KTestSvgMimeType)); 
+    iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpLaunched,KIconWidth3, KIconHeight3, KIconDepth1,KTestSvgMimeType));
+    iRemotableApp1->SetResourceStatusL(_L8("free"));
+
+    // Register the application which is already registered
+    iTmServer->RegisterAppL(iRemotableApp1);     
+    
+    _LIT( KDescription , "Registering of duplicate app is handled successfully");
+    aResult.SetResult( KErrNone, KDescription );
+    iLog->Log( KDescription );
+    
+    delete iTmServer;
+    iTmServer = NULL;
+    
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::RegisterDuplicateAppsL(  TTestResult& aResult  )
+    {   
+    _LIT( KLogInfo, "Register Duplicate Applications" );
+    iLog->Log( KLogInfo );
+
+    //Sets the information associated with the terminal mode server device    
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+       
+    _LIT8(KAppDesc, "Mobile Navigation Application");
+    iRemotableApp = CUpnpRemotableApp::NewL( KAppIdValue ,_L8("Navigation"));  
+    iRemotableApp->SetAppDescriptionL(KAppDesc());
+    CUpnpTmInfoElement& tmInfoElement = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement.AddTmInfoElementL(_L8("protocolID"),_L8("VNC"));
+    
+    CUpnpTmInfoElement& tmInfoElement1 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement1.AddTmInfoElementL(_L8("appCategory"),_L8("0x00010001"));
+    tmInfoElement1.AddTmInfoElementL(_L8("trustLevel"),_L8("0x80"));
+    
+    CUpnpTmInfoElement& tmInfoElement2 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EDisplayInfo);
+    tmInfoElement2.AddTmInfoElementL(_L8("contentCategory"),_L8("0x0000001"));
+    tmInfoElement2.AddTmInfoElementL(_L8("contentRules"),_L8("0x00000FE"));
+    tmInfoElement2.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+    iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMaps, KIconWidth1, KIconHeight1, KIconDepth,KTestSvgMimeType));
+      
+    // Register the application 
+    iTmServer->RegisterAppL(iRemotableApp);
+    
+    _LIT8(KAppDesc1, "RTP Audio Server");
+    iRemotableApp1 = CUpnpRemotableApp::NewL( KAppId1Value ,_L8("RTP Server"));
+    iRemotableApp1->SetAppDescriptionL(KAppDesc1());
+     
+    CUpnpTmInfoElement& tmInfoElement3 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement3.AddTmInfoElementL(_L8("protocolID"),_L8("RTP"));
+    tmInfoElement3.AddTmInfoElementL(_L8("format"),_L8("99"));
+    tmInfoElement3.AddTmInfoElementL(_L8("direction"),_L8("out"));
+       
+    CUpnpTmInfoElement& tmInfoElement4 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement4.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000002"));
+    tmInfoElement4.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+       
+    CUpnpTmInfoElement& tmInfoElement5 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAudioInfo);
+    tmInfoElement5.AddTmInfoElementL(_L8("audioType"),_L8("all"));    
+    iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicUnLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    iRemotableApp1->SetResourceStatusL(_L8("free"));
+     
+    iRemotableAppArray.AppendL(iRemotableApp1);     
+   
+    iRemotableApp2 = CUpnpRemotableApp::NewL( KAppId1Value ,_L8("RTP Server"));
+    iRemotableApp2->SetAppDescriptionL(KAppDesc1());
+        
+    CUpnpTmInfoElement& tmInfoElement6 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement6.AddTmInfoElementL(_L8("protocolID"),_L8("RTP"));
+    tmInfoElement6.AddTmInfoElementL(_L8("format"),_L8("99"));
+    tmInfoElement6.AddTmInfoElementL(_L8("direction"),_L8("out"));
+          
+    CUpnpTmInfoElement& tmInfoElement7 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement7.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000002"));
+    tmInfoElement7.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+          
+    CUpnpTmInfoElement& tmInfoElement8 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::EAudioInfo);
+    tmInfoElement8.AddTmInfoElementL(_L8("audioType"),_L8("all"));    
+    iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicUnLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    iRemotableApp2->SetResourceStatusL(_L8("free"));
+    iRemotableAppArray.AppendL(iRemotableApp2);     
+
+    // Register the dulplicate applications
+    iTmServer->RegisterAppsL( iRemotableAppArray);     
+    
+    _LIT( KDescription , "Registering of duplicate applications is handled successfully");
+    aResult.SetResult( KErrNone, KDescription );
+    iLog->Log( KDescription );
+    iRemotableAppArray.Close();
+    delete iTmServer;
+    iTmServer = NULL;
+    
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::UnRegisterAppL(  TTestResult& aResult  )
+    {
+    _LIT( KLogInfo, "UnRegister Application" );
+    iLog->Log( KLogInfo );
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Unregister the application by specifying AppId 
+    iTmServer->UnRegisterApp( KAppIdValue );
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+    
+    _LIT( KDescription , "Application is un-registered successfully");
+    aResult.SetResult( KErrNone, KDescription );
+    iLog->Log( KDescription );
+    
+    delete iTestTimer;
+    iTestTimer = NULL;
+    
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::UnRegisterAppsL(  TTestResult& aResult  )
+    {
+    _LIT( KLogInfo, "UnRegister Multiple Applications" );
+    iLog->Log( KLogInfo );
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+   
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);
+    
+    RArray<TUint> appIdArray;
+    appIdArray.AppendL( KAppId1Value );
+    appIdArray.AppendL( KAppId2Value );
+
+    //Unregister multiple applications by specifying array of AppIds  
+    iTmServer->UnRegisterApps( appIdArray); 
+
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+    
+    _LIT( KDescription , "Multiple Applications are un-registered successfully");
+    aResult.SetResult( KErrNone, KDescription );
+    iLog->Log( KDescription );
+    appIdArray.Close();
+    
+    delete iTestTimer;
+    iTestTimer = NULL;     
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::UnRegisterUnRegisteredAppL(  TTestResult& aResult  )
+    {
+    _LIT( KLogInfo, "UnRegister UnRegistered Application" );
+    iLog->Log( KLogInfo );
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);
+    
+    //Unregister the application which is already unregistered
+    iTmServer->UnRegisterApp( KNonExistentAppIdValue );
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+    
+    _LIT( KDescription , "UnRegistering of UnRegistered Application is handled successfully");
+    aResult.SetResult( KErrNone, KDescription );
+    iLog->Log( KDescription );
+    
+    delete iTestTimer;
+    iTestTimer = NULL;
+    
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::UnRegisterUnRegisteredAppsL(  TTestResult& aResult  )
+    {
+    _LIT( KLogInfo, "UnRegister Multiple UnRegistered Applications" );
+    iLog->Log( KLogInfo );
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);
+    
+    RArray<TUint> appIdArray;
+    appIdArray.AppendL( KNonExistentAppIdValue );
+    appIdArray.AppendL( KNonExistentAppId1Value );
+
+    //Unregister multiple applications which are already unregistered
+    iTmServer->UnRegisterApps( appIdArray);
+        
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+    
+    _LIT( KDescription , "UnRegistering of UnRegistered Applications is handled successfully");
+    aResult.SetResult( KErrNone, KDescription );
+    iLog->Log( KDescription );
+    
+    appIdArray.Close();
+    delete iTestTimer;
+    iTestTimer = NULL;
+    
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleEventDuplicateAppStatusUpdateL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Event For Duplicate AppStatus Update" );
+    iLog->Log( KLogInfo ); 
+          
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);
+       
+    //Start the tmserver device and its services              
+    iTmServer ->StartL();
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);          
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start();   
+    	         
+    if ( iDeviceVerified  )
+         { 
+             //Subscribe to Services
+           iSearchDevice->SubscribeToServiceL();         
+          }    
+    RArray<TUint> updatedAppIdList;
+    updatedAppIdList.Append(KAppId1Value);
+    updatedAppIdList.Append(KAppId1Value);
+    //Update the status of applications which have undergone some change
+    iTmServer->UpdateAppStatusL(updatedAppIdList); 
+       
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+       
+    if ( iStatusNotified )
+         {
+          _LIT( KDescription , "Handle Event For Duplicate AppStatus Update handled successfully");
+          aResult.SetResult( KErrNone, KDescription );
+          iLog->Log( KDescription );
+         }
+    else
+         {
+          aResult.iResult = KErrGeneral;
+          _LIT( KDescription , "Handle Event For Duplicate AppStatus Update handling Failed");
+          aResult.SetResult( KErrNone, KDescription );
+          iLog->Log( KDescription );
+         }
+    updatedAppIdList.Close();  
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+  }
+
+TInt CTmServerTest::HandleEventProfileIdListStatusUpdateL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Event For ProfileIdList Status Update" );
+    iLog->Log( KLogInfo ); 
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);
+    
+    //Start the tmserver device and its services
+    iTmServer ->StartL();
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start();  
+    
+    if ( iDeviceVerified  )
+        {
+        //Subscribes to a service 
+        iSearchDevice->SubscribeToServiceL();
+        }  
+
+    RArray<TUint> UnusedProfileIdList;
+    UnusedProfileIdList.Append(5);
+    UnusedProfileIdList.Append(6);
+    //Update the list of profile IDs for profiles which are not used
+    iTmServer->UpdateUnusedProfileIdsL(UnusedProfileIdList);     
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+
+    if ( iStatusNotified )
+        {
+        _LIT( KDescription , "Handle Event For ProfileIdList Status Update handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Handle Event For ProfileIdList Status Update handling failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    
+       UnusedProfileIdList.Close();
+       delete iDiscoveryTestTimer;
+       iDiscoveryTestTimer = NULL;
+       delete iTestTimer;
+       iTestTimer = NULL;
+       REComSession::FinalClose();
+       return KErrNone;
+   }
+
+TInt CTmServerTest::HandleLaunchAppActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo , "Handle LaunchApp Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+   
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);
+
+    //Start the tmserver device and its services
+    iTmServer ->StartL();
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    	
+    if ( iDeviceVerified  )
+        {
+         //Launch the application remotely by specifying appId and profileId 
+         iSearchDevice->LaunchAppActionL(KAppId1Value,KProfileIdValue);
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iStartApp )
+        {
+        _LIT( KDescription , "LaunchApp Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "LaunchApp Command handled  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleTerminateAppActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle TerminateApp Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);
+
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified )
+        {
+        //Terminate the application which is already running
+        iSearchDevice->TerminateAppActionL( KAppId1Value,KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if ( iStopApp)
+        {
+        _LIT( KDescription , "TerminateApp Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "TerminateApp Command handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidAppIdLaunchAppActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid AppId LaunchApp Command" );
+    iLog->Log( KLogInfo );    
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified  )
+        {
+        //Launch the application by specifying invalid appId
+        iSearchDevice->LaunchAppActionL( KInvalidAppIdValue,KProfileIdValue);
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iStartApp )
+        {
+        _LIT( KDescription , "LaunchApp Command with invalid AppId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "LaunchApp Command with invalid AppId handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidProfileIdLaunchAppActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid ProfileId LaunchApp Command" );
+    iLog->Log( KLogInfo );    
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified  )
+        {
+        //Launch the application by specifying invalid profileId
+        iSearchDevice->LaunchAppActionL( KAppId1Value,KInvalidProfileIdValue);
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    if (iStartApp )
+        {
+        _LIT( KDescription , "LaunchApp Command with invalid ProfileId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "LaunchApp Command with invalid ProfileId handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleNonExistentLaunchAppActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle LaunchApp Command For Non-Existent AppID" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+
+    //Start the tmserver device and its services
+    iTmServer->StartL();  
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+        //Launch the application by specifying non-existent appId
+        iSearchDevice->LaunchAppActionL( KNonExistentAppIdValue, KProfileIdValue );
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iStartApp )
+        {
+        _LIT( KDescription , "LaunchApp Command For Non-Existent AppID handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "LaunchApp Command For Non-Existent AppID handled  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleUnauthorizedLaunchAppActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle LaunchApp Command For UnAuthorized AppID" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);
+    
+    //Start the tmserver device and its services
+    iTmServer ->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Launch the application by specifying unauthorized appId
+         iSearchDevice->LaunchAppActionL(KAppId5Value,KProfileIdValue);
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    if (iStartApp )
+        {
+       _LIT( KDescription , "LaunchApp Command For UnAuthorized AppID handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "LaunchApp Command For UnAuthorized AppID handled  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleDeviceLockedLaunchAppActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Device Locked Condition For LaunchApp Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);
+    
+    //Start the tmserver device and its services
+    iTmServer ->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Launch the application
+         iSearchDevice->LaunchAppActionL(KAppId4Value,KProfileIdValue);
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    if (iStartApp )
+        {
+       _LIT( KDescription , "LaunchApp Command For Device Locked Condition handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "LaunchApp Command For Device Locked Condition handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleNonExistentTerminateAppActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle TerminateApp Command For Non-Existent AppID" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();    
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified )
+        {
+         //Terminate the application by specifying unauthorized appId
+         iSearchDevice->TerminateAppActionL( KNonExistentAppIdValue,KProfileIdValue );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if ( iStopApp)
+        {
+        _LIT( KDescription , "TerminateApp Command For Non-Existent App ID handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "TerminateApp  Command handling for Non-Existent App Id Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidAppIdTerminateAppActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid AppId TerminateApp Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified )
+        {
+         //Terminate the application by specifying invalid appId
+         iSearchDevice->TerminateAppActionL(  KInvalidAppIdValue,KProfileIdValue );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if ( iStopApp)
+        {
+        _LIT( KDescription , "TerminateApp Command with invalid AppId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "TerminateApp Command with invalid AppId handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidProfileIdTerminateAppActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid ProfileId TerminateApp Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();    
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified )
+        {
+         //Terminate the application by specifying invalid profileId
+         iSearchDevice->TerminateAppActionL(  KAppId1Value,KInvalidProfileIdValue );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if ( iStopApp)
+        {
+        _LIT( KDescription , "TerminateApp Command with invalid ProfileId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "TerminateApp Command with invalid ProfileId handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleUnauthorizedTerminateAppActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle TerminateApp Command UnAuthorized AppID" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);    
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();    
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified )
+        {
+         //Terminate the application by specifying unauthorized appId
+         iSearchDevice->TerminateAppActionL( KAppId5Value,KProfileIdValue );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();     
+    if ( iStopApp)
+        {
+        _LIT( KDescription , "TerminateApp Command For Un-Authorized App ID handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "TerminateApp  Command handling For Un-Authorized App ID Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleDeviceLockedTerminateAppActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Device Locked Condition For TerminateApp Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);
+    
+    //Start the tmserver device and its services
+    iTmServer ->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Terminate the application
+         iSearchDevice->TerminateAppActionL(KAppId4Value,KProfileIdValue);
+        }   
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    if (iStopApp )
+        {
+       _LIT( KDescription , "TerminateApp Command For Device Locked Condition handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "TerminateApp Command For Device Locked Condition handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppStatusActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppStatus Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);     
+
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the status of application
+         iSearchDevice->GetAppStatusActionL( KAppId1Value );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iGetAppStatus)
+        {
+        _LIT( KDescription , "GetAppStatus Command  handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppStatus Command handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleWildcardGetAppStatusActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppStatus Command For All the Applications" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the status of all the application
+         iSearchDevice->GetAppStatusActionL( KAppId5Value );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iGetAppStatus)
+        {
+        _LIT( KDescription , "GetAppStatus Command  handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppStatus Command handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+
+TInt CTmServerTest::HandleInvalidAppIdGetAppStatusActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppStatus Command For Invalid AppId" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);    
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        { 
+         //Retrieve the status of the application by specifying invalid appId
+         iSearchDevice->GetAppStatusActionL( KInvalidAppIdValue );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iGetAppStatus)
+        {
+        _LIT( KDescription , "GetAppStatus Command with invalid AppId  handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppStatus Command with invalid AppId handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleNonExistentGetAppStatusActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppStatus Command For Non-Existent AppID" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();  
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the status of the application by specifying non existent appId
+         iSearchDevice->GetAppStatusActionL( KNonExistentAppIdValue );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+
+    if (iGetAppStatus)
+        {
+        _LIT( KDescription , "GetAppStatus Command for Non-Existent App ID handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppStatus Command handling for Non-Existent App ID Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleEventAppStatusUpdateL( TTestResult& aResult )
+ {
+    _LIT( KLogInfo, "Handle Event For AppStatus Update" );
+    iLog->Log( KLogInfo ); 
+       
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);
+    
+    //Start the tmserver device and its services              
+    iTmServer ->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    	       
+    if ( iDeviceVerified  )
+         {
+          //Subscribes to a service 
+          iSearchDevice->SubscribeToServiceL();
+         }
+    RArray<TUint> updatedAppIdList;
+    updatedAppIdList.Append(KAppId1Value);
+    updatedAppIdList.Append(KAppId2Value);
+    
+    //Update the status of applications which have undergone some change
+    iTmServer->UpdateAppStatusL(updatedAppIdList); 
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+    
+    if ( iStatusNotified )
+         {
+          _LIT( KDescription , "Handle Event For AppStatus Update handled successfully");
+          aResult.SetResult( KErrNone, KDescription );
+          iLog->Log( KDescription );
+         }
+    else
+         {
+          aResult.iResult = KErrGeneral;
+          _LIT( KDescription , "Handle Event For AppStatus Update handling Failed");
+          aResult.SetResult( KErrNone, KDescription );
+          iLog->Log( KDescription );
+         }
+    updatedAppIdList.Close();
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+  }
+
+TInt CTmServerTest::HandleEventAppListUpdateL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Event For AppList Update" );
+    iLog->Log( KLogInfo ); 
+       
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications 
+    RegisterApplicationsL(*iTmServer);
+    
+    //Start the tmserver device and its services              
+    iTmServer ->StartL();
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);          
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start();  
+          
+    if ( iDeviceVerified  )
+         {
+          //Subscribes to a service 
+          iSearchDevice->SubscribeToServiceL();        
+         }  
+      
+    TInt errorCode;
+    CUpnpRemotableApp& aRemotableApp = iTmServer->GetRemotableApp(KAppIdValue ,errorCode );
+    if (errorCode == KErrNone)
+        { 
+         _LIT8(KAppDesc, "Mobile Device Display");
+         aRemotableApp.SetAppDescriptionL(KAppDesc());
+        }
+    RArray<TUint> updatedAppIdList;
+    updatedAppIdList.Append(KAppIdValue);
+    updatedAppIdList.Append(KAppId2Value);
+   
+    //Update the list of applications which have been modified to/from the list
+    iTmServer->UpdateAppListL(updatedAppIdList);      
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();
+    
+    if ( iStatusNotified )
+         {
+          _LIT( KDescription , "Handle Event For AppList Update handled successfully");
+          aResult.SetResult( KErrNone, KDescription );
+          iLog->Log( KDescription );
+         }
+    else
+         {
+          aResult.iResult = KErrGeneral;
+          _LIT( KDescription , "Handle Event For AppList Update handling Failed");
+          aResult.SetResult( KErrNone, KDescription );
+          iLog->Log( KDescription );
+         }
+    updatedAppIdList.Close();
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+  }
+
+TInt CTmServerTest::HandleGetAppListActionFilter1L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command with Filter1" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+          //Retrieve the list of applications by specifying filter value
+          iSearchDevice->GetAppListActionL(KAppListFilterValue1(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Filter1 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Filter1 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionFilter2L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList with Filter2 Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the list of applications by specifying filter value
+         iSearchDevice->GetAppListActionL(KAppListFilterValue2(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Filter2 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Filter2 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionFilter3L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList with Filter3 Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the list of applications by specifying filter value 
+         iSearchDevice->GetAppListActionL(KAppListFilterValue3(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Filter3 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Filter3 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionFilter4L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList with Filter4 Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the list of applications by specifying filter value 
+         iSearchDevice->GetAppListActionL(KAppListFilterValue4(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Filter4 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Filter4 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionInvalidArg1L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg1" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);    
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+          _LIT8(KInvalidFilter1,"\"name=\"*Audio*\"" );
+         //Retrieve the list of applications by specifying invalid filter value
+         iSearchDevice->GetAppListActionL(KInvalidFilter1(),KProfileIdValue);  
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Invalid Arg1 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Invalid Arg1 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+
+TInt CTmServerTest::HandleGetAppListActionInvalidArg2L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg2" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         _LIT8(KInvalidFilter2, "\"name=\"*nav*\",appInfo=\"*\"\""); 
+         //Retrieve the list of applications by specifying invalid filter value
+         iSearchDevice->GetAppListActionL(KInvalidFilter2(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Invalid Arg2 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Invalid Arg2 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionInvalidArg3L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg3" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         _LIT8(KInvalidFilter3, "\"name=\"*Audio*\",@audioType=\"*\"\"");
+         //Retrieve the list of applications by specifying invalid filter value
+         iSearchDevice->GetAppListActionL(KInvalidFilter3(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Invalid Arg3 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Invalid Arg3 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionInvalidArg4L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg4" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         _LIT8(KInvalidFilter4, "\"icon@mimetype\"*svg+xml*\"\"");
+         //Retrieve the list of applications by specifying invalid filter value
+         iSearchDevice->GetAppListActionL(KInvalidFilter4(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Invalid Arg4 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Invalid Arg4 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionInvalidArg5L ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command with Invalid Arg5" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);   
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         _LIT8(KInvalidFilter5, "\"name=\"*nav*\"appInfo@appCategory=\"*\"\"");
+         //Retrieve the list of applications by specifying invalid filter value
+         iSearchDevice->GetAppListActionL(KInvalidFilter5(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with Invalid Arg5 handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with Invalid Arg5 handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionNoFilterL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetAppList Command With No Filter" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);    
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the list of applications
+         iSearchDevice->GetAppListActionL( KWildCard(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command With No Filter handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command With No Filter handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidProfileIdGetAppListActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid ProfileId GetAppList Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this );
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the list of applications by specifying invalid profileId
+         iSearchDevice->GetAppListActionL(KWildCard(),KInvalidProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "GetAppList Command with invalid ProfileId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetAppList Command with invalid ProfileId  handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetAppListActionOperationRejectedL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Operation Rejected Condition For GetAppList Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this );
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+    iOperationRejected = ETrue; 
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+    
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the list of applications by specifying profileId
+         iSearchDevice->GetAppListActionL(KAppListFilterValue1(),KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();      
+    if (iGetAppList)
+        {
+        _LIT( KDescription , "Handle Operation Rejected Condition For GetAppList Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Handle Operation Rejected Condition For GetAppList Command handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleSetClientProfileActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle SetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL(); 
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         // Register the client profile 
+         iSearchDevice->SetClientProfileActionL(KProfileIdValue, KClientProfileInfo);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iSetClientProfile)
+        {
+        _LIT( KDescription , "SetClientProfile Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "SetClientProfile Command handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    iClientIconPrefArray.ResetAndDestroy();
+    iClientIconPrefArray.Close();
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidProfileIdSetClientProfileActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid ProfileId SetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);    
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Register the client profile with invalid profileId
+         iSearchDevice->SetClientProfileActionL(KInvalidProfileIdValue, KClientProfileInfo );
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iSetClientProfile)
+        {
+        _LIT( KDescription , "SetClientProfile Command with invalid ProfileId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "SetClientProfile Command with invalid ProfileId handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidProfileSetClientProfileActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid Profile SetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+        _LIT8(KInvalidProfile,"&lt;clientProfile");
+        //Register the client profile with invalid profile
+        iSearchDevice->SetClientProfileActionL(KProfileIdValue, KInvalidProfile());
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iSetClientProfile)
+        {
+        _LIT( KDescription , "SetClientProfile Command with invalid Profile handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "SetClientProfile Command with invalid Profile handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleDeviceLockedSetClientProfileActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Device Locked Condition For SetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+        //Register the client profile 
+        iSearchDevice->SetClientProfileActionL(KProfileIdValue, KDeviceLockedClientProfile());
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iSetClientProfile)
+        {
+        _LIT( KDescription , "Device Locked Condition for SetClientProfile Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Device Locked Condition for SetClientProfile Command handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleResourceBusySetClientProfileActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Resource Busy Condition For SetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+    
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer); 
+    
+    //Start the tmserver device and its services
+    iTmServer->StartL();
+    iResourceBusy = ETrue;
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+        //Register the client profile 
+        iSearchDevice->SetClientProfileActionL(KProfileIdValue, KClientProfileInfo());
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iSetClientProfile)
+        {
+        _LIT( KDescription , "Resource Busy Condition for SetClientProfile Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Resource Busy Condition for SetClientProfile Command handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetClientProfileActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);     
+
+    //Start the tmserver device and its services
+    iTmServer->StartL();   
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the contents of a client profile stored in the terminal mode device
+         iSearchDevice->GetClientProfileActionL(KProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iGetClientProfile)
+        {
+        _LIT( KDescription , "GetClientProfile Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetClientProfile Command handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleInvalidProfileIdGetClientProfileActionL ( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Invalid ProfileId GetClientProfile Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the control point and search for device
+    iTmServer->StartL();   
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Retrieve the contents of a client profile by specifying invalid profileId
+         iSearchDevice->GetClientProfileActionL(KInvalidProfileIdValue);
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iGetClientProfile)
+        {
+        _LIT( KDescription , "GetClientProfile Command with invalid ProfileId handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetClientProfile Command with invalid ProfileId handling Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+
+TInt CTmServerTest::HandleGetMaxNumProfilesActionL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle GetMaxNumProfiles Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the control point and search for device
+    iTmServer->StartL();   
+
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Get the maximum number of client profiles supported
+         iSearchDevice->GetMaxNumProfilesActionL();
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iGetMaxNumProfiles)
+        {
+        _LIT( KDescription , "GetMaxNumProfiles Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "GetMaxNumProfiles Command handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+TInt CTmServerTest::HandleGetMaxNumProfilesOperationRejectedL( TTestResult& aResult )
+    {
+    _LIT( KLogInfo, "Handle Operation Rejected Condition For GetMaxNumProfiles Command" );
+    iLog->Log( KLogInfo );
+    
+    iTmServerDeviceType = ETrue;
+
+    //Sets the information associated with the terminal mode server device
+    SetTmServerSettingsL();
+    iTmServer = CUpnpTmServer::NewL( *iTmServerDeviceInfo, *this ); 
+
+    //Register all the desired applications
+    RegisterApplicationsL(*iTmServer);  
+    
+    //Start the control point and search for device
+    iTmServer->StartL();   
+    iOperationRejected = ETrue; 
+    //Start the control point and search for device
+    iSearchDevice = CDiscoverDevice::NewL(*this);    
+    iDiscoveryTestTimer = CDiscoveryTestTimer::NewL(*this);
+    iDiscoveryTestTimer->AfterDiscovery(15);
+    CActiveScheduler::Start(); 
+
+    if ( iDeviceVerified  )
+        {
+         //Get the maximum number of client profiles supported
+         iSearchDevice->GetMaxNumProfilesActionL();
+        }
+    
+    iTestTimer = CTestTimer::NewL(*this);
+    iTestTimer->After(15);
+    CActiveScheduler::Start();  
+    
+    if (iGetMaxNumProfiles)
+        {
+        _LIT( KDescription , "Operation Rejected Condition For GetMaxNumProfiles Command handled successfully");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    else
+        {
+        aResult.iResult = KErrGeneral;
+        _LIT( KDescription , "Operation Rejected Condition For GetMaxNumProfiles Command handling  Failed");
+        aResult.SetResult( KErrNone, KDescription );
+        iLog->Log( KDescription );
+        }
+    delete iDiscoveryTestTimer;
+    iDiscoveryTestTimer = NULL;
+    delete iTestTimer;
+    iTestTimer = NULL;
+    REComSession::FinalClose();
+    return KErrNone;
+    }
+
+// ========================================================================================================
+
+void CTmServerTest::SetTmServerSettingsL()
+    { 
+    iTmServerDeviceInfo = CUpnpTmServerDeviceInfo::NewL(CUpnpSettings::GetIapL());  
+    iTmServerDeviceInfo->SetDeviceInfoL( KDeviceInfo );
+    iTmServerDeviceInfo->SetBtAddressL( KBtMacValue );
+    iTmServerDeviceInfo->SetStartConn(ETrue);
+    iTmServerDeviceInfo->AddDeviceIconL(CUpnpTerminalModeIcon::NewL(KIconDevicePath, KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    }
+
+void CTmServerTest::RegisterApplicationsL(CUpnpTmServer& aTmServer )
+    {  
+    RArray<TUint> allowedProfileIdList;
+    allowedProfileIdList.Append(0);
+    allowedProfileIdList.Append(1);
+    allowedProfileIdList.Append(2);
+    allowedProfileIdList.Append(2);
+    allowedProfileIdList.Append(3);
+    allowedProfileIdList.Append(4);
+    allowedProfileIdList.Append(5);
+    allowedProfileIdList.Append(6);
+
+    _LIT8(KAppDesc, "Mobile Navigation Application");
+    iRemotableApp = CUpnpRemotableApp::NewL( KAppIdValue ,_L8("Navigation"));  
+    iRemotableApp->SetAppDescriptionL(KAppDesc());
+    iRemotableApp->SetAllowedProfileIdListL(allowedProfileIdList);   
+    CUpnpTmInfoElement& tmInfoElement = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement.AddTmInfoElementL(_L8("protocolID"),_L8("VNC"));
+    
+    CUpnpTmInfoElement& tmInfoElement1 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement1.AddTmInfoElementL(_L8("appCategory"),_L8("0x00010001"));
+    tmInfoElement1.AddTmInfoElementL(_L8("trustLevel"),_L8("0x80"));
+    
+    CUpnpTmInfoElement& tmInfoElement2 = iRemotableApp->CreateTmInfoElementL(CUpnpTmInfoElement::EDisplayInfo);
+    tmInfoElement2.AddTmInfoElementL(_L8("contentCategory"),_L8("0x0000001"));
+    tmInfoElement2.AddTmInfoElementL(_L8("contentRules"),_L8("0x00000FE"));
+    tmInfoElement2.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+    iRemotableApp->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMaps, KIconWidth1, KIconHeight1, KIconDepth,KTestSvgMimeType));
+    aTmServer.RegisterAppL(iRemotableApp);   
+    allowedProfileIdList.Close();
+   
+    _LIT8(KAppDesc1, "RTP Audio Server");
+    iRemotableApp1 = CUpnpRemotableApp::NewL( KAppId1Value ,_L8("RTP Server"));
+    iRemotableApp1->SetAppDescriptionL(KAppDesc1());
+    
+    CUpnpTmInfoElement& tmInfoElement3 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement3.AddTmInfoElementL(_L8("protocolID"),_L8("RTP"));
+    tmInfoElement3.AddTmInfoElementL(_L8("format"),_L8("99"));
+    tmInfoElement3.AddTmInfoElementL(_L8("direction"),_L8("out"));
+    
+    CUpnpTmInfoElement& tmInfoElement4 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement4.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000002"));
+    tmInfoElement4.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+    
+    CUpnpTmInfoElement& tmInfoElement5 = iRemotableApp1->CreateTmInfoElementL(CUpnpTmInfoElement::EAudioInfo);
+    tmInfoElement5.AddTmInfoElementL(_L8("audioType"),_L8("all"));    
+    iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicUnLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    iRemotableApp1->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathMusicLaunched,KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType));
+    iRemotableApp1->SetResourceStatusL(_L8("free"));
+   
+    iRemotableAppArray.AppendL(iRemotableApp1);      
+
+    _LIT8(KAppDesc2, "Bluetooth A2DP Audio Server");
+    iRemotableApp2 = CUpnpRemotableApp::NewL( KAppId2Value ,_L8("Bluetooth A2DP"));
+    iRemotableApp2->SetAppDescriptionL(KAppDesc2());
+    
+    CUpnpTmInfoElement& tmInfoElement6 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement6.AddTmInfoElementL(_L8("protocolID"),_L8("BTA2DP"));
+    tmInfoElement6.AddTmInfoElementL(_L8("direction"),_L8("out"));
+    
+    CUpnpTmInfoElement& tmInfoElement7 = iRemotableApp2->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement7.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000003"));
+    tmInfoElement7.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001"));
+    
+    iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpUnLaunched, KIconWidth2, KIconHeight2, KIconDepth1,KTestSvgMimeType)); 
+    iRemotableApp2->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtA2DpLaunched,KIconWidth3, KIconHeight3, KIconDepth1,KTestSvgMimeType));
+    iRemotableApp2->SetResourceStatusL(_L8("free"));
+    iRemotableAppArray.AppendL(iRemotableApp2);      
+    
+     _LIT8(KAppDesc3, "Bluetooth HFP Audio");
+    RArray<TUint> allowedProfileIdList1;
+    allowedProfileIdList1.Append(0);
+    iRemotableApp3 = CUpnpRemotableApp::NewL( KAppId3Value,_L8("Bluetooth HFP"));
+    iRemotableApp3->SetAppDescriptionL(KAppDesc3());
+    iRemotableApp3->SetAllowedProfileIdListL(allowedProfileIdList1);
+    
+    CUpnpTmInfoElement& tmInfoElement8 = iRemotableApp3->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement8.AddTmInfoElementL(_L8("protocolID"),_L8("BTHFP"));
+    tmInfoElement8.AddTmInfoElementL(_L8("direction"),_L8("bi"));
+    
+    CUpnpTmInfoElement& tmInfoElement9 = iRemotableApp3->CreateTmInfoElementL(CUpnpTmInfoElement::EAppInfo);
+    tmInfoElement9.AddTmInfoElementL(_L8("appCategory"),_L8("0x0000004"));
+    tmInfoElement9.AddTmInfoElementL(_L8("trustLevel"),_L8("0x00000001")); 
+   
+    iRemotableApp3->AddIconL(CUpnpTerminalModeIcon::NewL(KIconPathBtHfp, KIconWidth, KIconHeight, KIconDepth,KTestSvgMimeType)); 
+    iRemotableApp3->SetResourceStatusL(_L8("busy"));    
+    iRemotableAppArray.AppendL(iRemotableApp3);     
+    allowedProfileIdList1.Close();
+    
+    _LIT8(KAppDesc4, "Device Attestation Protocol");
+    iRemotableApp4 = CUpnpRemotableApp::NewL( KAppId4Value ,_L8("Device Attestation"));
+    iRemotableApp4->SetAppDescriptionL(KAppDesc4());
+       
+    CUpnpTmInfoElement& tmInfoElement11 = iRemotableApp4->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement11.AddTmInfoElementL(_L8("protocolID"),_L8("DAP")); 
+    iRemotableAppArray.AppendL(iRemotableApp4); 
+
+    iRemotableApp5 = CUpnpRemotableApp::NewL( KAppId5Value ,_L8("Device Attestation"));
+    iRemotableApp5->SetAppDescriptionL(KAppDesc4());
+
+    RArray<TUint> allowedProfileIdList2;
+    allowedProfileIdList2.Append(1);    
+    allowedProfileIdList2.Append(1);
+    iRemotableApp5->SetAllowedProfileIdListL(allowedProfileIdList2);
+       
+    CUpnpTmInfoElement& tmInfoElement12 = iRemotableApp5->CreateTmInfoElementL(CUpnpTmInfoElement::ERemotingInfo);
+    tmInfoElement12.AddTmInfoElementL(_L8("protocolID"),_L8("DAP")); 
+    iRemotableAppArray.AppendL(iRemotableApp5);   
+    allowedProfileIdList2.Close();
+    
+    aTmServer.SetXmlSignatureL(KXmlSignature);    
+    aTmServer.RegisterAppsL(iRemotableAppArray); 
+    iRemotableAppArray.Close();
+    }
+
+void CTmServerTest::TestTimerTimedOutL()
+    {
+    iTmServer->StopL();
+    delete iSearchDevice;
+    iSearchDevice = NULL;
+    delete iTmServer;
+    iTmServer = NULL;
+    delete iTmServerDeviceInfo;
+    iTmServerDeviceInfo = NULL;   
+    CActiveScheduler::Stop();
+    }
+
+void CTmServerTest::TestTimerDiscoveryTimedOut()
+    {
+    CActiveScheduler::Stop();
+    }
+
+void CTmServerTest::DeviceVerified()
+    {
+    iDeviceVerified = ETrue;
+    }
+
+void CTmServerTest::DeviceLostVerified()
+    {
+    iDeviceLostVerified = ETrue;
+    }
+
+void CTmServerTest::ServiceVerified()
+    {
+    iServiceVerified = ETrue;
+    }
+
+CDiscoverDevice* CDiscoverDevice::NewL(CTmServerTest& aTmServerTest)
+    {
+    CDiscoverDevice* self = new (ELeave) CDiscoverDevice(aTmServerTest);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CDiscoverDevice::CDiscoverDevice(CTmServerTest& aTmServerTest):
+    iTmServerTest(aTmServerTest)
+    {
+    
+    }
+
+void CDiscoverDevice::ConstructL()
+    {
+    CDesC8ArrayFlat* targetDeviceTypes = new (ELeave) CDesC8ArrayFlat( 1 );
+    CleanupStack::PushL( targetDeviceTypes ); 
+    targetDeviceTypes->AppendL( KTmServerDevice() );    
+    CUpnpControlPoint::ConstructL( *targetDeviceTypes );
+    CleanupStack::Pop( targetDeviceTypes );
+    targetDeviceTypes->Reset();
+    delete targetDeviceTypes;
+    targetDeviceTypes = NULL;
+
+    //SSDP search for Terminalmode server devices
+    if (iTmServerTest.iTmServerDeviceType)
+         {
+          SearchL( KTmServerDevice() );
+          }
+    else if (iTmServerTest.iTmServerServiceType)
+          {
+          SearchL( KTmServerService() );
+          }   
+     }
+
+CDiscoverDevice::~CDiscoverDevice()
+    {   
+
+    }
+
+
+void CDiscoverDevice::StateUpdatedL( CUpnpService* aService )
+    {
+    CUpnpDevice& device = aService->Device();
+    if (aService->ServiceType().Match( KTmServerServiceType ) != KErrNotFound )
+        {
+        TInt err =  TmServerStateUpdated( device, aService );
+        }
+    else
+        {
+        User::Leave(KErrGeneral);
+        }
+    }
+
+TInt CDiscoverDevice::TmServerStateUpdated( CUpnpDevice& aDevice,
+                                                        CUpnpService*& aService )
+    {
+    CUpnpStateVariable* appStatusUpdate = aService->StateVariable( KArgTypeAppStatusUpdate );
+    if( !appStatusUpdate )
+        {
+        iTmServerTest.iStatusNotified = EFalse;
+        return KErrArgument;
+        }
+    else
+        {
+        const TDesC8& deviceUuid = aDevice.Uuid();
+        const TDesC8& statusBuf = appStatusUpdate->Value(); 
+
+        iTmServerTest.iStatusNotified = ETrue;
+        }
+    return KErrNone;
+    }
+
+void CDiscoverDevice::DeviceDiscoveredL( CUpnpDevice* aDevice )
+    {
+    if( iTmServerTest.iTmServerDeviceType)
+        {
+        if(aDevice->DeviceType().Compare(KTmServerDevice) == KErrNone )
+            {
+            iTmServerTest.DeviceVerified();   
+            }
+        }
+    else if( iTmServerTest.iTmServerServiceType)
+        {
+        if(aDevice->ServiceDescriptionReceiveState()== CUpnpDevice::EAllServicesAdded)
+            {
+            iTmServerTest.ServiceVerified();
+            }
+        }
+    }
+
+void CDiscoverDevice::DeviceDisappearedL( CUpnpDevice* /*aDevice */)
+    {
+     iTmServerTest.DeviceLostVerified();
+    }
+
+void CDiscoverDevice::ActionResponseReceivedL( CUpnpAction* aAction )
+    {
+    CUpnpService& service = aAction->Service();
+    if( service.ServiceType().Length() <= 0 )
+        {
+        User::Leave(KErrArgument);
+        }
+    if (aAction->Name().Compare(KGetApplicationList) == KErrNone)
+        {
+        aAction->ArgumentValue( KAppListing );
+        iTmServerTest.iGetAppList = ETrue;
+        }
+    else if (aAction->Name().Compare(KLaunchApp) == KErrNone)
+        {
+        aAction->ArgumentValue( KAppLaunchStatus );
+        iTmServerTest.iStartApp = ETrue;
+        }
+    else if (aAction->Name().Compare(KTerminateApp) == KErrNone)
+        {
+        aAction->ArgumentValue( KAppTerminateStatus );
+        iTmServerTest.iStopApp = ETrue;
+        }
+    else if (aAction->Name().Compare(KGetAppStatus) == KErrNone)
+        {
+        aAction->ArgumentValue( KAppStatus );
+        iTmServerTest.iGetAppStatus = ETrue;
+        }
+    else if (aAction->Name().Compare(KSetClientProfile) == KErrNone)
+        {
+        aAction->ArgumentValue( KResultProfile );
+        iTmServerTest.iSetClientProfile = ETrue;
+        }
+    else if (aAction->Name().Compare(KGetClientProfile) == KErrNone)
+        {
+        aAction->ArgumentValue( KClientProfile );
+        iTmServerTest.iGetClientProfile = ETrue;
+        }
+    else if (aAction->Name().Compare(KGetMaxNumProfiles) == KErrNone)
+        {
+        aAction->ArgumentValue( KNumProfilesAllowed );
+        iTmServerTest.iGetMaxNumProfiles = ETrue;
+        }
+    }
+
+ void CDiscoverDevice::HttpResponseReceivedL( CUpnpHttpMessage* /*aMessage*/ )
+    {
+    
+    }
+
+
+TInt CDiscoverDevice::GetAppListActionL( const TDesC8& aAppListFilter ,TInt aProfileId )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound )
+            {
+            CUpnpAction* action = services[i]->CreateActionLC( KGetApplicationList );
+               if( action )
+                  {
+                  TBuf8<8> buf;
+                  buf.Num(aProfileId); 
+                  action->SetArgumentL(KAppFilter, aAppListFilter );
+                  action->SetArgumentL(KProfileId, buf );
+                  SendL( action );                 
+                  CleanupStack::Pop( action );
+                  return action->SessionId();
+                  }
+               else
+                  {
+                  return KErrGeneral;
+                  }
+            }
+        }
+    return KErrNotFound;
+    }
+
+
+
+TInt CDiscoverDevice::LaunchAppActionL( TInt aAppId, TInt aProfileId )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound )
+            {
+            CUpnpAction* action =  services[i]->CreateActionLC( KLaunchApp );
+            if( action )
+              {
+                  TBuf8<8> buf;
+                  buf.Num(aAppId);  
+                  action->SetArgumentL( KAppId, buf );                                  
+                  buf.Zero();
+                  buf.Num(aProfileId);  
+                  action->SetArgumentL( KProfileId, buf );                  
+               }            
+              SendL( action );
+              CleanupStack::Pop( action );
+              return action->SessionId();
+              }
+            else
+              {
+              return KErrGeneral;
+              }
+            }
+        return KErrNotFound;
+    }
+
+TInt CDiscoverDevice::TerminateAppActionL( TInt aAppId, TInt aProfileId )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound )
+            {
+            CUpnpAction* action =  services[i]->CreateActionLC( KTerminateApp );
+            if( action )
+              {
+                  TBuf8<8> buf;
+                  buf.Num(aAppId);             
+                  action->SetArgumentL( KAppId, buf );
+                  buf.Zero();
+                  buf.Num(aProfileId);             
+                  action->SetArgumentL( KProfileId, buf );
+               }            
+
+              SendL( action );
+              CleanupStack::Pop( action );
+              return action->SessionId();
+              }
+            else
+              {
+              return KErrGeneral;
+              }
+            }       
+    return KErrNotFound;
+    }
+
+TInt CDiscoverDevice::GetAppStatusActionL( TInt aAppId )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound )
+            {
+            CUpnpAction* action = services[i]->CreateActionLC( KGetAppStatus );
+            if( action )
+               {
+               TBuf8<8> buf;
+               buf.Num(aAppId); 
+               if ( aAppId == KAppId1Value || aAppId == KNonExistentAppIdValue )
+                    {   
+                    action->SetArgumentL( KAppId, buf );                 
+                    }              
+               else if( aAppId == KAppId5Value )
+                   {
+                    _LIT8(KWildCard, "*");
+                    action->SetArgumentL( KAppId, KWildCard());
+                   }   
+               else
+                   {
+                   action->SetArgumentL( KAppId, KNullDesC8());
+                   }
+               SendL( action );
+               CleanupStack::Pop( action );
+               return action->SessionId();
+               }
+            else
+               {
+               return KErrGeneral;
+               }
+             }
+         }
+     return KErrNotFound;
+     }
+
+TInt CDiscoverDevice::SetClientProfileActionL(TInt aProfileId, const TDesC8& aClientInfoValue )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType1 ) != KErrNotFound )
+            {
+            CUpnpAction* action = services[i]->CreateActionLC( KSetClientProfile);
+            if( action )
+               {   
+               TBuf8<8> buf;
+               buf.Num(aProfileId); 
+               action->SetArgumentL(KProfileId1, buf );
+               action->SetArgumentL(KClientProfile, aClientInfoValue );
+               SendL( action );
+               CleanupStack::Pop( action );
+               return action->SessionId();
+               }
+            else
+               {
+               return KErrGeneral;
+               }
+             }
+         }
+     return KErrNotFound;
+     }
+
+TInt CDiscoverDevice::GetClientProfileActionL(TInt aProfileId )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType1 ) != KErrNotFound )
+            {
+            CUpnpAction* action = services[i]->CreateActionLC( KGetClientProfile);
+            if( action )
+               {   
+               TBuf8<8> buf;
+               buf.Num(aProfileId); 
+               action->SetArgumentL(KProfileId1, buf );
+               SendL( action );
+               CleanupStack::Pop( action );
+               return action->SessionId();
+               }
+            else
+               {
+               return KErrGeneral;
+               }
+             }
+         }
+     return KErrNotFound;
+     }
+
+TInt CDiscoverDevice::GetMaxNumProfilesActionL( )
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        return KErrBadHandle;
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        return KErrNotFound;
+        }
+    RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+    
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType1 ) != KErrNotFound )
+            {
+            CUpnpAction* action = services[i]->CreateActionLC( KGetMaxNumProfiles);
+            if( action )
+               {   
+               SendL( action );
+               CleanupStack::Pop( action );
+               return action->SessionId();
+               }
+            else
+               {
+               return KErrGeneral;
+               }
+             }
+         }
+     return KErrNotFound;
+     }
+
+void CDiscoverDevice::SubscribeToServiceL()
+    {
+    const RPointerArray<CUpnpDevice>& deviceList = DeviceList();
+    if( deviceList.Count() == KErrNone ) 
+        {
+        User::Leave( KErrBadHandle );
+        }
+    TInt i(0);
+    while ( deviceList[i]->DeviceType().Compare(KTmServerDevice()) != KErrNone )
+        {
+        i++;
+        }
+    if( i == deviceList.Count()) 
+        {
+        User::Leave ( KErrNotFound );
+        }
+        RPointerArray<CUpnpService>& services = const_cast<CUpnpDevice*>(deviceList[i])->ServiceList();
+        
+    for( TInt i(0); i < services.Count(); i++ )
+        {
+        if( services[i]->ServiceType().Match( KTmServerServiceType ) != KErrNotFound )
+            {
+            SubscribeL( services[i] ); 
+            }
+        }
+    }
+
+TTerminalModeErrorCode CTmServerTest::OnGetApplicationList(TUint aProfileId ) 
+    {
+    if(iOperationRejected )
+        {
+        return ETerminalModeOperationRejected;
+        }
+    else if ( ( aProfileId == 0 ) || ( aProfileId == 1 ) || ( aProfileId == 2) || ( aProfileId == 3 ) 
+            || ( aProfileId == 4 ) || ( aProfileId == 5 ) || ( aProfileId == 6 ) ) 
+        { 
+        return ETerminalModeSuccess;   
+        } 
+    return ETerminalModeInvalidProfileId; 
+    }
+
+TTerminalModeErrorCode CTmServerTest::OnLaunchApp( TUint aAppId, RBuf8& aUrl, TUint aProfileId )                                                                       
+    {
+    if ( ( aProfileId != 0 ) && ( aProfileId != 1 ) && ( aProfileId != 2) && ( aProfileId != 3 ) 
+             && ( aProfileId != 4 ) && ( aProfileId != 5 ) && ( aProfileId != 6 ) ) 
+        { 
+        return ETerminalModeInvalidProfileId;   
+        }
+    aUrl.Close();
+    if ( aAppId == KAppIdValue )
+        {
+        _LIT8(KUrl, "VNC://192.168.4.1:5900");
+        aUrl.Create(KUrl());
+        }
+    else if ( aAppId == KAppId1Value )
+        {
+        _LIT8(KUrl, "RTP://192.168.2.1:5900");
+        aUrl.Create(KUrl());
+        }
+    else if ( aAppId == KAppId2Value )
+        {
+        _LIT8(KUrl, "BTA2DP://192.168.2.1:5900");
+        aUrl.Create(KUrl());
+        }
+    else if  ( aAppId == KAppId3Value)
+        {
+        _LIT8(KUrl, "BTHFP://192.168.2.1:5900");
+        aUrl.Create(KUrl());
+        }
+    else if  ( aAppId == KAppId4Value)
+        {
+        return ETerminalModeDeviceLocked;
+        }
+    else 
+        {
+        return ETerminalModeUnauthorizedApp;
+        }   
+    return ETerminalModeSuccess;
+    }
+    
+TTerminalModeErrorCode CTmServerTest::OnTerminateApp( TUint aAppId, TUint aProfileId )
+    {
+    if ( ( aProfileId != 0 ) && ( aProfileId != 1 ) && ( aProfileId != 2) && ( aProfileId != 3 ) 
+             && ( aProfileId != 4 ) && ( aProfileId != 5 ) && ( aProfileId != 6 ) ) 
+         { 
+         return ETerminalModeInvalidProfileId;   
+         }
+   if ( aAppId == KAppIdValue|| aAppId == KAppId1Value || aAppId == KAppId2Value || aAppId == KAppId3Value)
+       {
+        return ETerminalModeSuccess;
+       }
+   else if  ( aAppId == KAppId4Value)
+       {
+        return ETerminalModeDeviceLocked;
+       }
+   else
+       {
+        return ETerminalModeUnauthorizedApp;
+       }
+    }
+
+TTerminalModeErrorCode CTmServerTest::OnGetAppStatus(  TUint aAppId, TUint& aProfileId ,RBuf8& aStatusType )
+    {
+    aProfileId = KErrNone;
+    aStatusType.Close();
+    if ( aAppId == KAppIdValue )
+        {
+        aStatusType.Create(KBackground());
+        }
+    else if ( aAppId == KAppId1Value )
+        {
+         aStatusType.Create(KForeground());
+        }
+    else if ( aAppId == KAppId2Value )
+        {
+        aStatusType.Create(KBackground());
+        }
+    else if ( aAppId == KAppId3Value )
+        {
+        aStatusType.Create(KForeground());
+        }  
+    else
+        {
+        aStatusType.Create(KBackground());
+        } 
+    return ETerminalModeSuccess;
+    }
+
+TTerminalModeErrorCode CTmServerTest::OnGetMaxNumProfiles( TUint& aProfileIdCount )
+    {
+    if (iOperationRejected )
+        {
+        return ETerminalModeOperationRejected;
+        }
+    else
+        {
+        aProfileIdCount = 9;
+        return ETerminalModeSuccess;  
+        }
+    }
+
+TTerminalModeErrorCode CTmServerTest::OnSetClientProfile(TUint aProfileId, const TDesC8& aClientProfile,RBuf8& aResultProfile  )
+    {
+    _LIT8(KClientInfo,"<clientProfile><clientID>Cl_2</clientID></clientProfile>");
+    if(iResourceBusy)
+        {
+        return ETerminalModeResourceBusy;
+        }
+    else if(aClientProfile.Compare(KClientInfo()) == KErrNone )
+         {
+         return ETerminalModeDeviceLocked;   
+         }  
+    else if ( ( aClientProfile.Find(_L8("<clientProfile><")) == KErrNotFound ) &&
+        ( aClientProfile.Find(_L8("&lt;clientProfile&gt;&lt;")) == KErrNotFound ))
+       {
+       return ETerminalModeInvalidProfile;   
+       }
+    CUpnpTmClientIconPref* clientIconPref = NULL;
+    if ( aProfileId == 0 )
+       {
+       // different mime type but same dimension
+       clientIconPref = CUpnpTmClientIconPref::NewL(0);
+       clientIconPref->SetWidth(88);
+       clientIconPref->SetHeight(88);   
+       }
+    else if ( aProfileId == 1 )
+       {
+       // different mime type and different dimension
+       clientIconPref = CUpnpTmClientIconPref::NewL(1);
+       clientIconPref->SetMimeTypeL(_L8("image/bmp"));
+       clientIconPref->SetWidth(70);
+       clientIconPref->SetHeight(80);   
+       }
+    else if ( aProfileId == 2 )
+       {
+       // different mime type and no dimension specified by the client
+       clientIconPref = CUpnpTmClientIconPref::NewL(2); 
+       clientIconPref->SetMimeTypeL(_L8("image/bmp"));
+       }
+    else if ( aProfileId == 3 )
+       {
+       // same mime type but different dimension
+       clientIconPref = CUpnpTmClientIconPref::NewL(3);
+       clientIconPref->SetMimeTypeL(_L8("image/svg+xml"));
+       clientIconPref->SetWidth(100);
+       clientIconPref->SetHeight(100);       
+       }
+    else if ( aProfileId == 4 )
+       {
+       // same mime type but no dimension specified by the client
+       clientIconPref = CUpnpTmClientIconPref::NewL(4);
+       clientIconPref->SetMimeTypeL(_L8("image/svg+xml"));  
+       }
+    else if ( aProfileId == 5 )
+       {
+       // same mime type and same dimension
+       clientIconPref = CUpnpTmClientIconPref::NewL(5);
+       clientIconPref->SetMimeTypeL(_L8("image/svg+xml")); 
+       clientIconPref->SetWidth(88);
+       clientIconPref->SetHeight(88); 
+       }
+    else if ( aProfileId == 6 )
+        {
+        // different mime type(jpeg) and different dimensions
+        clientIconPref = CUpnpTmClientIconPref::NewL(6);
+        clientIconPref->SetMimeTypeL(_L8("image/jpeg")); 
+        clientIconPref->SetWidth(36);
+        clientIconPref->SetHeight(44); 
+        }
+    else
+       {
+       return ETerminalModeInvalidProfileId;     
+       }
+    iClientIconPrefArray.AppendL(clientIconPref);
+    RBuf8 clientProfile;
+    clientProfile.Create(aClientProfile);
+    aResultProfile.Close();
+    aResultProfile.Create(clientProfile);
+    clientProfile.Close();
+    return ETerminalModeSuccess;
+    }
+
+TTerminalModeErrorCode CTmServerTest::OnGetClientProfile( TUint aProfileId, RBuf8& aClientProfile)
+    {
+    if ( ( aProfileId == 0 ) || ( aProfileId == 1 ) || ( aProfileId == 2) || ( aProfileId == 3 ) 
+            || ( aProfileId == 4 ) || ( aProfileId == 5 ) || ( aProfileId == 6 ) ) 
+         { 
+         aClientProfile.Close();
+         aClientProfile.Create(KClientProfile());
+         return ETerminalModeSuccess;   
+         } 
+    return ETerminalModeInvalidProfileId;  
+    }
+
+const CUpnpTmClientIconPref& CTmServerTest::GetClientIconPrefsL( TUint aProfileId )
+    {
+    CUpnpTmClientIconPref* clientIconPref = NULL;
+    for ( TInt i(0); i < iClientIconPrefArray.Count(); i++ )
+        {
+        if ( iClientIconPrefArray[i]->ClientProfileId() == aProfileId )     
+            {
+            clientIconPref = iClientIconPrefArray[i];  
+            break;
+            }
+        }
+    return *clientIconPref;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/group/bld.inf	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,37 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file provides the information required for exporting
+*	       domain headers to system inlcude path.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/upnptmserver.h                      MW_LAYER_PLATFORM_EXPORT_PATH( upnptmserver.h )
+../inc/upnptmserverobserver.h              MW_LAYER_PLATFORM_EXPORT_PATH( upnptmserverobserver.h )
+../inc/upnpremotableapp.h                  MW_LAYER_PLATFORM_EXPORT_PATH( upnpremotableapp.h )
+../inc/upnpremotableapp.inl                MW_LAYER_PLATFORM_EXPORT_PATH( upnpremotableapp.inl )
+../inc/upnptminfoelement.h                 MW_LAYER_PLATFORM_EXPORT_PATH( upnptminfoelement.h )
+../inc/upnptminfoelement.inl               MW_LAYER_PLATFORM_EXPORT_PATH( upnptminfoelement.inl )
+../inc/upnptmserverdeviceinfo.h            MW_LAYER_PLATFORM_EXPORT_PATH( upnptmserverdeviceinfo.h )
+../inc/upnptmserverdeviceinfo.inl          MW_LAYER_PLATFORM_EXPORT_PATH( upnptmserverdeviceinfo.inl )
+../inc/upnpterminalmodeicon.h              MW_LAYER_PLATFORM_EXPORT_PATH( upnpterminalmodeicon.h )
+../inc/upnpterminalmodeicon.inl            MW_LAYER_PLATFORM_EXPORT_PATH( upnpterminalmodeicon.inl )
+../inc/terminalmodeconsts.h                MW_LAYER_PLATFORM_EXPORT_PATH( terminalmodeconsts.h )
+../inc/upnptmclienticonpref.h              MW_LAYER_PLATFORM_EXPORT_PATH( upnptmclienticonpref.h )
+../inc/upnptmclienticonpref.inl            MW_LAYER_PLATFORM_EXPORT_PATH( upnptmclienticonpref.inl )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/terminalmodeconsts.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,119 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class defines all the error codes related to Terminal Mode Service
+*
+*/
+
+#ifndef __TERMINALMODECONSTS_H__
+#define __TERMINALMODECONSTS_H__
+
+/**
+ * Error codes for Terminal Mode extention 
+ * These error codes are located in the non-standard error code range 
+ * (800 – 899).
+ */
+enum TTerminalModeErrorCode
+    {
+    /**
+     * Terminal Mode success error code.
+     * Represents the no-error condition.
+     */
+    ETerminalModeSuccess = 200,
+
+    /**
+     * Terminal Mode failure error code.
+     * Represents the error condition.
+     */
+    ETerminalModeFailure = 201,
+
+    /**
+     *Terminal Mode error range marker.
+     */
+    ETerminalModeErrorRangeBegin = 700,
+
+    /**
+     * Operation Rejected. 
+     * Terminal Mode Server rejected the operation.
+     */
+    ETerminalModeOperationRejected = 701,
+
+    /**
+     * Malformed or Non-existent AppID.
+     * The AppID is of incorrect format or does not exist.
+     */
+    ETerminalModeBadAppId = 810,
+
+    /**
+     * Unauthorized AppID.
+     * The application identified by this AppID cannot be used remotely.
+     */
+    ETerminalModeUnauthorizedApp = 811,
+
+    /**
+     * Cannot determine application status.
+     * The status of the application cannot be cur-rently determined. 
+     * Client should try again later.
+     */
+    ETerminalModeAppStatusError = 812,
+
+    /**
+     * Failed to launch application.
+     * The application is available on the mobile device but failed 
+     * to launch.
+     */
+    ETerminalModeAppLaunchError = 813,
+        
+    /**
+     * The requested application resource is busy.
+     * This error can occur when the resource is already busy and 
+     * resourceStatus in the AppListing is set equal to “NA”.
+     */
+    ETerminalModeResourceBusy = 814,
+        
+    
+    /**
+     * Failed to process the action as the device hosting the TmApplicationServer 
+     * service is locked
+     */
+    ETerminalModeDeviceLocked = 815,
+    
+    /**
+     * Failed to process the action as the input argument passed is invalid
+     */
+    ETerminalModeInvalidArgument = 820,
+        
+    /**
+     * The clientProfile argument passed does not conform to A_ARG_TYPE_ClientProfile
+     * XML specifications.
+     */
+    ETerminalModeInvalidProfile = 825,
+    
+    /**
+     * Failed to process the action as the the profile identifier does not exist 
+     * or the application cannot use the specified profile identifier.
+     */
+    ETerminalModeInvalidProfileId = 830,
+    
+    /**
+     * Invalid license.The HU does not have valid license or has not started license 
+     * verification process for the service.
+     */
+    ETerminalModeInvalidLicense = 891,
+    /**
+     * Terminal Mode error range marker.
+     */
+    ETerminalModeErrorRangeEnd = 899
+    };
+
+#endif // __TERMINALMODECONSTS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnpremotableapp.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,130 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpRemotableApp class declaration
+*
+*/
+
+#ifndef __UPNPREMOTABLEAPP_H__
+#define __UPNPREMOTABLEAPP_H__
+
+#include <e32base.h>    
+#include <upnpterminalmodeicon.h>
+#include <upnptminfoelement.h>
+
+/**
+* Class represents a Remotable App or just "app" in the 
+* context of Terminal Mode Service. 
+* The Automotive Server (or equivalent) is responsible for creating an object 
+* of this class and registering it with the Terminal Mode Service. 
+* The Terminal Mode Service will maintain a list of these registered apps throughout 
+* it's lifetime. The Automotive Server can remove apps from this list by 
+* unregistering them. 
+*/
+class CUpnpRemotableApp : public CBase
+    {
+public: 
+    /**
+    * Standard Symbian Two-Phase constructor
+    * @param	aAppId			The locally unique ID of the App being registered.
+	*							The Terminal Mode Service will check for the uniqueness
+	*							of this ID when this Remotable app object is registered.
+	* @param	aAppName		The Name of the App being registered. The Terminal Mode
+	*							Service will *not* check for uniqueness. However, it's 
+	*							recommended that this is unique as well.
+	* @see	CUpnpTmServer::RegisterAppL, CUpnpTmServer::RegisterAppsL
+    */    
+    IMPORT_C static CUpnpRemotableApp* NewL( TUint aAppId ,const TDesC8& aAppName );
+	
+	~CUpnpRemotableApp();	
+    /**
+     * Method that sets the brief description about the application( remotable app )
+     * An optional element.
+     * @param aDescription Description of the Application
+     */
+    IMPORT_C void SetAppDescriptionL( const TDesC8& aDescription );
+    /**
+     * Method to set the list of allowed profile IDs associated with the remotable app.
+     * An optional element.
+     * @aProfileIdList  Reference to an array of profile IDs.
+     *                  A copy of array is maintained.
+     */
+    IMPORT_C void SetAllowedProfileIdListL( const RArray<TUint>& aProfileIdList );
+    /**
+    * Method that adds a new icon to this Remotable App.
+    * An optional element.
+    * @param	aIcon	[in] The Icon object. Must be instantiated by the caller prior to
+	*					this call. Should be non-NULL.
+	*					The ownership is transferred to the CUpnpRemotableApp object.
+	* @see	CUpnpTerminalModeIcon
+    */    
+	IMPORT_C void AddIconL( CUpnpTerminalModeIcon* aIcon );
+    /**
+    * Method that creates a new terminal mode info object and adds it to the list of
+	* terminal mode info objects supported by this app. The terminal mode info object thus 
+	* created will be internally maintained by Remotable App object.A reference of the same
+	* will be returned to the caller. 
+	* Only protocolID of the remotingInfo element is the required element as per the schema,
+	* otherwise all other info types and their elements are optional.
+    * @param aTerminalModeInfoType	Terminal Mode Info Type as an Enum value. 
+	* @see	CUpnpTerminalModeInfoElement
+    */    
+	IMPORT_C CUpnpTmInfoElement& CreateTmInfoElementL( CUpnpTmInfoElement
+	                                ::TTerminalModeInfoType aTerminalModeInfoType );
+    /**
+    * Method is used to define the current status of the resource.
+    * An optional element.
+    * @param aResourceStatus  Status of the resource. Can take one of these values;
+    *        Free, busy or NA
+    */    
+	IMPORT_C void SetResourceStatusL( const TDesC8& aResourceStatus );
+    /**
+    * "Getter" method for retrieving the list of icons associated with this
+	* Remotable app object.An optional element.
+    * @return Returns RPointerArray of icons.
+	* @see CUpnpTerminalModeIcon
+    */    
+	inline const RPointerArray<CUpnpTerminalModeIcon>& IconList()const;
+    /**
+    * "Getter" Method for retrieving the list of terminal mode info details associated with
+    * this Remotable app object.
+    * @return Returns RPointerArray of terminal mode info objects. 
+    * @see  CUpnpTerminalModeInfo
+    */    
+    inline const RPointerArray<CUpnpTmInfoElement>& TmInfoElementList()const;
+
+	// inlined "Getter" methods 
+	inline TUint AppId()const;
+	inline const TDesC8& AppName()const;
+	inline const TDesC8& AppDescription()const;
+	inline const TDesC8& ResourceStatus()const;
+	inline const RArray<TUint>& AllowedProfileIdList()const;
+	
+protected:
+	CUpnpRemotableApp( TUint aAppId );
+    void ConstructL( const TDesC8& aAppName );
+
+private:
+    TUint                                   iAppId;
+    RBuf8                                   iAppName;
+    RBuf8                                   iAppDescription;
+    RBuf8                                   iResourceStatus;
+	RPointerArray<CUpnpTerminalModeIcon>    iIconList;
+	RPointerArray<CUpnpTmInfoElement>       iTmInfoElementList;
+	RArray<TUint>                           iProfileIdList;
+    };
+
+#include <upnpremotableapp.inl>
+
+#endif //__UPNPREMOTABLEAPP_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnpremotableapp.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,98 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __UPNPREMOTABLEAPP_INL__
+#define __UPNPREMOTABLEAPP_INL__
+
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::IconList
+// Method is used to retreive icon list.
+// @return Returns reference to the list of CUpnpTerminalModeIcon objects
+// ---------------------------------------------------------------------------------
+//
+inline const RPointerArray<CUpnpTerminalModeIcon>& CUpnpRemotableApp::IconList()const
+    {
+    return iIconList;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::TmInfoElementList
+// Method is used to retrieve terminal mode info list
+// @return Returns reference to an array of CUpnpTmInfoElement objects
+// ---------------------------------------------------------------------------------
+//
+inline const RPointerArray<CUpnpTmInfoElement>& CUpnpRemotableApp::TmInfoElementList()const
+    {
+    return iTmInfoElementList;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::AppId
+// Method is used to retrieve application ID.
+// @return Returns appID.
+// ---------------------------------------------------------------------------------
+//
+inline TUint CUpnpRemotableApp::AppId()const
+    {
+    return iAppId;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::AppName
+// Method is used to retrieve applicationName.
+// @return Returns application name.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpRemotableApp::AppName()const
+    {
+    return iAppName;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::AppDescription
+// Method is used to retrieve brief description of the application.
+// @return Returns application description.
+// ---------------------------------------------------------------------------------
+inline const TDesC8& CUpnpRemotableApp::AppDescription()const
+    {
+    return iAppDescription;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::ResourceStatus
+// Method is used to retrieve current sttaus of the resource.
+// @return Returns the resource status of the application.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpRemotableApp::ResourceStatus()const
+    {
+    return iResourceStatus;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpRemotableApp::AllowedProfileIdList
+// Method is used to retrieve list of allowed profile IDs for the application.
+// @return Returns the reference to the array of profile IDs.
+// ---------------------------------------------------------------------------------
+//
+inline const RArray<TUint>& CUpnpRemotableApp::AllowedProfileIdList()const
+    {
+    return iProfileIdList;
+    }
+
+#endif  //__UPNPREMOTABLEAPP_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnpterminalmodeicon.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,105 @@
+/**
+* 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: CUpnpTerminalModeIcon class declaration
+*
+*/
+
+#ifndef __UPNPTERMINALMODEICON_H__
+#define __UPNPTERMINALMODEICON_H__
+
+#include <e32base.h>   
+
+// CLASS DECLARATION
+/**
+* This class encapsulates an icon used in any operation of the 
+* Terminal Mode Service implemented.
+* This represents device and application icons (as provided by Automotive Server).
+*/
+class CUpnpTerminalModeIcon : public CBase
+    {
+public:    
+    /**
+    * Standard Symbian Two-Phase constructor. Returns a pointer to the new element.
+    * @param aPath     icon path
+    * @param aWidth    icon width
+    * @param aHeight   icon height
+    * @param aDepth    icon depth
+    * @param aMimeType icon mime type
+    */    
+    IMPORT_C static CUpnpTerminalModeIcon* NewL(const TDesC16& aPath, const TInt aWidth,  
+                        const TInt aHeight,const TInt aDepth, const TDesC8& aMimeType );
+    /**
+    * Destructor. 
+    */
+    ~CUpnpTerminalModeIcon();
+     
+public: 
+    /**
+    * Returns the icon filename
+    * @return Returns the icon filename along with complete filepath.
+    */
+    inline const TDesC& IconFilename()const;
+    
+    /**
+    * Returns the width of the icon.
+    * @return Returns width in pixels or KErrNotFound
+    */
+    inline TInt Width()const;
+    
+    /**
+    * Returns the height of the icon.
+    * @return Returns height in pixels or KErrNotFound
+    */
+    inline TInt Height()const;
+    
+    /**
+    * Returns the color depth of the icon.
+    * @return Returns icon depth or KErrNotFound
+    */
+    inline TInt Depth()const;   
+    
+    /**
+    * Returns the mime type.
+    * @return Returns Icon mime type
+    */
+    inline const TDesC8& MimeType()const;
+    
+private:    
+    /**
+    * C++ default constructor.
+    * @param aWidth    icon width
+    * @param aHeight   icon height
+    * @param aDepth    icon depth 
+    */
+    CUpnpTerminalModeIcon( const TInt aWidth,const TInt aHeight,const TInt aDepth );
+    /**
+     * 2nd phase constructor
+     * @param aPath     icon path
+     * @param aMimeType icon mime type
+     */ 
+    void ConstructL( const TDesC16& aPath,const TDesC8& aMimeType );
+
+private:    	
+    HBufC*                 iFilename;
+    TInt                   iIconWidth;
+    TInt                   iIconHeight;
+    TInt                   iIconDepth;
+    HBufC8*                iIconMimeType;
+    };
+
+#include <upnpterminalmodeicon.inl>
+
+#endif  //__UPNPTERMINALMODEICON_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnpterminalmodeicon.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,80 @@
+/**
+* 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: CUpnpTerminalModeIcon INL file
+*
+*/
+
+#ifndef __UPNTERMINALMODEICON_INL__
+#define __UPNTERMINALMODEICON_INL__
+   
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::IconFilename
+// Returns the icon filename along with the complete filepath.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC& CUpnpTerminalModeIcon::IconFilename()const
+   {
+   if ( iFilename )
+       {
+       return *iFilename;
+       }
+   return KNullDesC();
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::Width
+// Returns the width of the icon.
+// ---------------------------------------------------------------------------------
+//
+inline TInt CUpnpTerminalModeIcon::Width()const
+   {
+   return iIconWidth;
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::Height
+// Returns the height of the icon.
+// ---------------------------------------------------------------------------------
+//
+inline TInt CUpnpTerminalModeIcon::Height()const
+    {
+    return iIconHeight;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::Depth
+// Returns the depth of the icon.
+// -------------------------------------------------------------------------------------
+//
+inline TInt CUpnpTerminalModeIcon::Depth()const
+    {
+    return iIconDepth;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTerminalModeIcon::MimeType
+// Returns the mime type of the icon.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpTerminalModeIcon::MimeType()const
+    {
+    if ( iIconMimeType )
+       {
+       return *iIconMimeType;
+       }
+    return KNullDesC8();
+    }
+
+
+#endif  //__UPNTERMINALMODEICON_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptmclienticonpref.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,119 @@
+/**
+* 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: CUpnpTmClientIconPref class declaration.
+*
+*/
+
+#ifndef __UPNPTMCLIENTICONPREF_H__
+#define __UPNPTMCLIENTICONPREF_H__
+
+#include <e32base.h>   
+
+const TUint KDefaultDepthValue = 24;
+
+// CLASS DECLARATION
+/**
+ * The class specifies the icon preferences corresponding to each Client
+ * Profile.It describes the mime type and the dimensions that client adhering to
+ * a particular profile supports. AutomotiveServer sets the icon preferences and
+ * sends the same to TM Service when requested.
+ */
+class CUpnpTmClientIconPref: public CBase
+    {
+public: 
+    /**
+    * Two-phased constructor. returns a pointer to the new element.
+    * @param aProfileId Client profile ID
+    * @param aWidth     icon width
+    * @param aHeight    icon height
+    * @param aDepth     icon depth
+    * @param aMimeType  icon mime type
+    */    
+    IMPORT_C static CUpnpTmClientIconPref* NewL( TUint aProfileId );
+    /**
+    * Destructor. 
+    */
+    ~CUpnpTmClientIconPref();
+    
+public: 
+    // inlined "setter" and "getter" methods
+    /**
+    * Returns the profileID.
+    * @return Returns the profileID of the client profile.
+    */
+    inline TUint ClientProfileId()const;
+    /**
+    * Returns the mime type.
+    * @return Returns icon mime type
+    */
+    inline const TDesC8& MimeType()const;
+    /**
+    * Returns the width of the icon.
+    * @return Returns width in pixels or KErrNotFound
+    */
+    inline TInt Width()const; 
+    /**
+    * Returns the height of the icon.
+    * @return Returns height in pixels or KErrNotFound
+    */
+    inline TInt Height()const;
+    /**
+    * Returns the color depth of the icon.
+    * @return Returns icon depth or KErrNotFound
+    */
+    inline TInt Depth()const;
+    /**
+    * Method is used to provide the preferred mime type of the client.
+    * @param aMimeType icon mime type
+    */
+    IMPORT_C void SetMimeTypeL( const TDesC8& aMimeType ); 
+    /**
+    * Sets icon width
+    * @param aWidth icon width
+    */
+    inline void SetWidth( const TInt aWidth );
+    /**
+    * Sets icon height
+    * @param aHeight icon height
+    */
+    inline void SetHeight( const TInt aHeight );
+    /**
+    * Sets icon depth
+    * @param aDepth icon depth
+    */
+    inline void SetDepth( const TInt aDepth );
+  
+private:  
+    /**
+    * C++ default constructor.
+    */
+    CUpnpTmClientIconPref( TUint aProfileId );
+    /**
+     * 2nd phase constructor
+     */ 
+    void ConstructL( );
+
+private: // Data   	
+    TUint                  iClientProfileId;
+    HBufC8*                iIconMimeType;
+    TInt                   iIconWidth;
+    TInt                   iIconHeight;
+    TInt                   iIconDepth;
+    };
+
+#include <upnptmclienticonpref.inl>
+
+#endif  //__UPNPTMCLIENTICONPREF_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptmclienticonpref.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,105 @@
+/**
+* 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: CUpnpTmClientIconPref INL file
+*
+*/
+
+#ifndef __UPNPTMCLIENTICONPREF_INL__
+#define __UPNPTMCLIENTICONPREF_INL__
+   
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::ClientProfileId
+// Returns the profileID of the client profile.
+// ---------------------------------------------------------------------------------
+//
+inline TUint CUpnpTmClientIconPref::ClientProfileId()const
+    {
+    return iClientProfileId;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::MimeType
+// Returns the mime type of the icon.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpTmClientIconPref::MimeType()const
+    {
+    return *iIconMimeType;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::Width
+// Returns the width of the icon.
+// ---------------------------------------------------------------------------------
+//
+inline TInt CUpnpTmClientIconPref::Width()const
+   {
+   return iIconWidth;
+   }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::Height
+// Returns the height of the icon.
+// ---------------------------------------------------------------------------------
+//
+inline TInt CUpnpTmClientIconPref::Height()const
+    {
+    return iIconHeight;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::Depth
+// Returns the depth of the icon.
+// -------------------------------------------------------------------------------------
+//
+inline TInt CUpnpTmClientIconPref::Depth()const
+    {
+    return iIconDepth;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::SetWidthL
+// Method is used to set the width of the icon which TM client supports
+// @param aWidth   Width of the icon
+// ---------------------------------------------------------------------------------
+//
+inline void CUpnpTmClientIconPref::SetWidth( TInt aWidth ) 
+    {
+    iIconWidth = aWidth;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::SetHeightL
+// Method is used to set the height of the icon which TM client supports
+// @param aHeight   Height of the icon
+// ---------------------------------------------------------------------------------
+//
+inline void CUpnpTmClientIconPref::SetHeight( TInt aHeight )
+    {
+    iIconHeight = aHeight;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmClientIconPref::SetDepthL
+// Method is used to set the color depth of the icon which TM client supports
+// @param aDepth   Color depth of the icon
+// ---------------------------------------------------------------------------------
+//
+inline void CUpnpTmClientIconPref::SetDepth( TInt aDepth ) 
+    {
+    iIconDepth = aDepth;
+    }
+
+#endif  //__UPNPTMCLIENTICONPREF_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptminfoelement.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,75 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmInfoElement class declaration 
+*
+*/
+
+#ifndef __UPNPTMINFOELEMENT_H__
+#define __UPNPTMINFOELEMENT_H__
+
+#include <e32base.h>
+#include <badesca.h>
+
+//Literals
+_LIT8(KRemotingInfo,   "remotingInfo" );
+_LIT8(KAppInfo,        "appInfo" );
+_LIT8(KDisplayInfo,    "displayInfo" );
+_LIT8(KAudioInfo,      "audioInfo" );
+
+/**
+ * Class represents the list of key-value pairs for each terminal mode info type.
+ * Used by the AutomotiveServer to provide name-value pairs for the associated application
+ */
+class CUpnpTmInfoElement : public CBase
+    {
+public:
+    enum TTerminalModeInfoType
+        {
+        ERemotingInfo,
+        EAppInfo,
+        EDisplayInfo,
+        EAudioInfo
+        };
+    /**
+    * Standard Symbian Two-phased constructor.  
+    */
+    static CUpnpTmInfoElement* NewL( TTerminalModeInfoType aTerminalModeInfoType );
+    // Destructor
+    ~CUpnpTmInfoElement();
+    /**
+    * Method is used to set terminal mode info key-value pair
+    */
+    IMPORT_C void AddTmInfoElementL( const TDesC8& aName,const TDesC8& aValue );
+    // Unexported getter method
+    void GetTmInfoElementL( RBuf8& aInfoElementName, 
+                               RBuf8& aInfoElementValue, TInt aIndex )const;
+    // inlined getter methods
+    inline const TDesC8& TerminalModeInfoType( )const;
+    inline TInt TmInfoElementCount()const;
+
+private:
+    CUpnpTmInfoElement();
+    void ConstructL( TTerminalModeInfoType aTerminalModeInfoType );
+
+private:
+    HBufC8*                   iInfoTypeBuffer;
+    RArray<RBuf8>             iInfoElementNameArray;
+    RArray<RBuf8>             iInfoElementValueArray;
+    RBuf8                     iElementName;
+    RBuf8                     iElementValue;
+    };
+
+#include <upnptminfoelement.inl>
+
+#endif  //__UPNPTMINFOELEMENT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptminfoelement.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,42 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __UPNPTMINFOELEMENT_INL__
+#define __UPNPTMINFOELEMENT_INL__
+
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::TerminalModeInfoType
+// Method is used to retrieve terminal mode info type
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpTmInfoElement::TerminalModeInfoType( )const
+    {
+    return *iInfoTypeBuffer;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmInfoElement::TmInfoElementCount
+// Method is used to retrieve the number of key-value pairs for each info type
+// ---------------------------------------------------------------------------------
+//
+TInt CUpnpTmInfoElement::TmInfoElementCount()const
+    {
+    return iInfoElementNameArray.Count();
+    }
+
+#endif  //__UPNPTMINFOELEMENT_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptmserver.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,159 @@
+/**
+* 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: CUpnpTmServer class declaration
+*
+*/
+
+#ifndef __UPNPTMSERVER_H__
+#define __UPNPTMSERVER_H__
+
+//  Include Files
+#include <e32base.h>    // CBase 
+#include <upnptmserverdeviceinfo.h>
+#include <upnptmserverobserver.h>
+#include <upnpremotableapp.h>
+
+//Forward Declaration
+class CUpnpTmServerImpl;
+
+
+/**
+ * The Main interface for the Terminal Mode Service. 
+ * The client of this class (Automotive Server or equivalent) is responsible
+ * for registering/unregistering the remotable apps and updating the status 
+ * of the running apps. 
+ * The client should also "start" and "stop" the service through the API
+ * provided in this class
+ */
+class CUpnpTmServer: public CBase
+    {
+public:
+    /**
+    * Standard Symbian Two-phased constructor. 
+    * @param aDeviceInfo The IAP and device Settings that the 
+    * 					 Terminal Mode Service needs to operate. 
+    * 					 A valid IAP ID is mandatory. 
+    * @param aUpnpTmServerObserver	The callback interface that the client
+    * 											application must implement.
+    */  
+    IMPORT_C static CUpnpTmServer* NewL( CUpnpTmServerDeviceInfo& aDeviceInfo,
+                                   MUpnpTmServerObserver& aUpnpTmServerObserver );
+    ~CUpnpTmServer();
+
+public:
+    /**
+    * Method to register a single App (aka Remotable App ). 
+    * The caller must create a CUpnpRemotableApp object and 
+    * populate it before calling this method. 
+    * @param aRemotableApp	A pointer to a Remotable App object.
+	*						"Ownership" of the object is passed.
+	*						Must not be NULL.
+    */    
+    IMPORT_C void RegisterAppL( CUpnpRemotableApp* aRemotableApp );
+    /**
+    * Method to register a list of Apps (aka Remotable Apps). 
+    * The caller must create all the CUpnpRemotableApp objects 
+    * and populate them before calling this method. 
+    * This list of apps will be appended to existing list of
+    * registered apps. 
+    * @param aRemotableAppList	A RPointerArray of Remotable App objects.
+	*							"Ownership" of all the objects is passed.
+	*		         			None of the objects must be NULL.
+    */    
+    IMPORT_C void RegisterAppsL( const RPointerArray<CUpnpRemotableApp>& aRemotableAppList );
+    /**
+    * Method to unregister a single App from the service. 
+    * The specified App must be registered with the 
+    * Terminal Mode Service. 
+    * @param aAppId	The ID of the app to be unregistered
+    */    
+    IMPORT_C TInt UnRegisterApp( TUint aAppId );
+    /**
+    * Method to unregister multiple Apps from the service. 
+    * The specified Apps must be registered with the 
+    * Terminal Mode Service. 
+    * In case of duplicate appIDs ,TM service will sort out the duplicate ones
+    * and will unregister only once for a particular appID.
+    * Even if a single app from the requested array is unable to get 
+    * un-registered the method should return KErrNotFound.
+    * @param aAppIdArray The list of IDs of the apps to be unregistered
+    */    
+    IMPORT_C TInt UnRegisterApps( const RArray<TUint>& aAppIdArray );  
+    /**
+     * Method to set the XML signature of the registered apps
+     * This is done as specified in XML Signature Syntax.
+     * The signature value is opaque to the TM Service.
+     * @param aSignature XML formatted buffer
+     */
+    IMPORT_C void SetXmlSignatureL( const TDesC8& aSignature );    
+    /**
+    * Method to Start the Terminal Moder Server Device and its services.
+    * This must be called to initiate all the UPnP related
+    * activities. 
+    */    
+    IMPORT_C void StartL();
+    /**
+    * Method to Stop the Terminal Moder Server Device and its services.
+    * No further UPnP related activities will occur after this. 
+    */    
+    IMPORT_C void StopL();
+    /**
+    * Method to fetch the Remotable App object by passing the 
+    * App ID of the same. Method is invoked by the Automotive Server
+    * when it wishes to modify any of the existing remotable app.
+    * @param aAppId App ID of the requested App
+    * @param aErr[out] Error code
+    * @return Returns reference to CUpnpRemotableApp object 
+    */ 
+    IMPORT_C CUpnpRemotableApp& GetRemotableApp( TUint aAppId, TInt& aErr );
+    /**
+    * Method through which the notification of applications whose status 
+    * has changed is sent across to the Car Kit through the Service .
+    * TM Service ignores the duplicate appIDs and sends only the list of
+    * unique appIDs.
+    * @param aUpdatedAppIdList List of appIDs whose status has changed
+    */    
+    IMPORT_C void UpdateAppStatusL( const RArray<TUint>& aUpdatedAppIdList );
+    /**
+    * Method through which the notification of applications whose entries
+    * in the application list have changed is sent across to the Car Kit 
+    * through the Service.
+    * TM Service ignores the duplicate appIDs and sends only the list of
+    * unique appIDs.
+    * @param aUpdatedAppIdList List of appIDs whose entries haave changed
+    */  
+    IMPORT_C void UpdateAppListL( const RArray<TUint>& aUpdatedAppIdList );
+    /**
+    * Method through which the notification of profileIDs which are not used
+    * used by any Terminal Mode service hosted on the Terminal Mode device
+    * is sent across to the Car Kit through the Service.
+    * TM Service ignores the duplicate profileIDs and sends only the list of
+    * unique profileIDs.
+    * @param aUnusedProfileIdList List of profile IDs for profiles which are 
+    *                  currently not being used by any Terminal Mode service 
+    */  
+    IMPORT_C void UpdateUnusedProfileIdsL( const RArray<TUint>& aUnusedProfileIdList );
+    
+private:
+    CUpnpTmServer();
+    void ConstructL( CUpnpTmServerDeviceInfo& aDeviceInfo, 
+                             MUpnpTmServerObserver& aUpnpRemoteServer );
+
+private:
+    // The "body"/implementation   
+    CUpnpTmServerImpl*   iTmServerImpl;   
+    };
+
+#endif  // __UPNPTMSERVER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptmserverdeviceinfo.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,98 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CUpnpTmServerDeviceInfo class declaration
+*
+*/
+
+#ifndef __UPNPTMSERVERDEVICEINFO_H__
+#define __UPNPTMSERVERDEVICEINFO_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <upnpterminalmodeicon.h>
+
+/**
+* This class represents device-specific parameters associated with 
+* Terminal Mode Server Device
+*/
+
+class CUpnpTmServerDeviceInfo: public CBase
+    {
+public: 
+	/**
+    * Standard Symbian Two-phased constructor. 
+    * @param aIapId IAP ID. 32 bit unsigned integer. IAP stands  for 
+    *              internet access point.It is mandatory to set IAP ID
+    *               
+    */  
+    IMPORT_C static CUpnpTmServerDeviceInfo* NewL( TUint32 aIapId );
+    /**
+     * Method to set the icon information associated with the Terminal Mode
+     * Server Device. It provides device icon information to the TM Sevice.
+     * @param aDeviceIcon Pointer to TM Icon object.
+     *                    Ownership of the object is passed.
+     * @see CUpnpTerminalModeIcon
+     */
+    IMPORT_C void AddDeviceIconL( CUpnpTerminalModeIcon* aDeviceIcon );
+    /**
+     * Method to set the Nokia specific additional information
+     * about the terminal mode server device.
+     * The entire deviceInfo element should as an xml formatted buffer should
+     * be provided as an input.
+     * The device info value is opaque to the TM Service.
+     * @param aDeviceInfo XML formatted buffer containing deviceInfo element.
+     */
+    IMPORT_C void SetDeviceInfoL( const TDesC8& aDeviceInfo );
+	/**
+	* Method to set Bluetooth  MAC address of the TM server device. 
+	* If this value is populated then it means that the device 
+    *                         supports Bluetooth communication
+	* @param aBtAddress Bt MAC address
+	*/
+    IMPORT_C void SetBtAddressL( const TDesC8& aBtAddress );
+    /**
+    * A setter to indicate that server device is able to initiate
+    * Bluetooth connection to client or not.
+    * @param aStartConn Boolean value
+    */
+    inline void SetStartConn( TBool aStartConn );
+	/**
+	* inlined "getter" methods for Terminal Mode Service's use.
+	*/
+    inline TUint32 IapId()const;
+    inline const RPointerArray<CUpnpTerminalModeIcon>& DeviceIconList()const;
+    inline const TDesC8& DeviceInfo( )const;
+    inline const TDesC8& BtAddress( )const;
+    inline TBool StartConn()const;       
+    ~CUpnpTmServerDeviceInfo();
+    
+private: 
+    CUpnpTmServerDeviceInfo( );
+    void ConstructL( TUint32 aIapId );
+
+private:
+    TUint32                                 iIapId;
+    HBufC8*                                 iDeviceInfo;
+    HBufC8*                                 iBtAddr;
+    TBool                                   iStartConnValue;
+    RPointerArray<CUpnpTerminalModeIcon>    iDeviceIconList;
+    };
+
+#include <upnptmserverdeviceinfo.inl>
+
+#endif // __UPNPTMSERVERDEVICEINFO_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptmserverdeviceinfo.inl	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,91 @@
+/**
+* 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 __UPNPTMSERVERDEVICEINFO_INL__
+#define __UPNPTMSERVERDEVICEINFO_INL__
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::SetStartConn
+// Method to set the boolean value which indicates whether the server device 
+// is able to initiate bluetooth connection to client or not.
+// @param aStartConn Boolean value ( True or false )
+// ---------------------------------------------------------------------------------
+//
+inline void CUpnpTmServerDeviceInfo::SetStartConn( TBool aStartConn )
+    {
+    iStartConnValue = aStartConn;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::IapId
+// Method is used to retrieve IAP ID.
+// ---------------------------------------------------------------------------------
+//
+inline TUint32 CUpnpTmServerDeviceInfo::IapId()const
+    {
+    return iIapId;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::DeviceIconList
+// Method is used to retrieve an array of device icons.
+// ---------------------------------------------------------------------------------
+//
+inline const RPointerArray<CUpnpTerminalModeIcon>& CUpnpTmServerDeviceInfo::DeviceIconList()const
+    {
+    return iDeviceIconList;
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::DeviceInfo
+// Method is used to retrieve additional information related to the device.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpTmServerDeviceInfo::DeviceInfo()const
+    {
+    if ( iDeviceInfo )
+        {
+        return *iDeviceInfo;
+        }
+    return KNullDesC8();
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::BtAddress
+// Method is used to retrieve the BT MAC address of the TM server device.
+// ---------------------------------------------------------------------------------
+//
+inline const TDesC8& CUpnpTmServerDeviceInfo::BtAddress()const
+    {
+    if ( iBtAddr )
+        {
+        return *iBtAddr;
+        }
+    return KNullDesC8();
+    }
+
+// ---------------------------------------------------------------------------------
+// CUpnpTmServerDeviceInfo::StartConn
+// Method is used to fetch the the boolean value for BT start connection preferences.
+// ---------------------------------------------------------------------------------
+//
+inline TBool CUpnpTmServerDeviceInfo::StartConn()const
+    {
+    return iStartConnValue;
+    }
+
+#endif  //__UPNPTMSERVERDEVICEINFO_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/terminalmodeservice_plat/inc/upnptmserverobserver.h	Tue Aug 31 16:06:48 2010 +0300
@@ -0,0 +1,114 @@
+/**
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MUpnpTmServerObserver interface definition
+*
+*/
+
+#ifndef __UPNPTMSERVEROBSERVER_H__
+#define __UPNPTMSERVEROBSERVER_H__
+
+#include <terminalmodeconsts.h>
+#include <upnptmclienticonpref.h>
+
+/**
+ * This is the main callback interface which the Terminal Mode Server application 
+ * needs to implement to handle the soap action requests from the Terminal Mode Clients.
+ * It also provides a method to fetch client's icon preferences from AutomotiveServer.
+ * 
+ */
+class MUpnpTmServerObserver
+    {
+public:
+    /**
+    * Method to intimate Automotive Server about the arrival of GetApplicationList soap action. 
+    * This is a synchronous call and the implementing class must return immediately
+    * @param   aProfileId Profile ID of the client profile whose parameter settings will be 
+    *                     applied for generating the application list
+    * @return  Returns Terminal Mode Error code
+    */    
+    virtual TTerminalModeErrorCode OnGetApplicationList( TUint aProfileId ) = 0;
+    /**
+    * Method to launch an app through the Automotive Server. 
+    * This is a synchronous call and the implementing class must return after
+	* launching the app. 
+    * @param   aAppId	  The App ID as registered with the Terminal Mode Service.
+    * @param   aUrl[out]  AS provides the actual URL where the application is running.
+    * @param   aProfileId Profile ID of the client profile whose parameter settings will be 
+    *                     applied for launching and executing the application
+    * @return  Returns Terminal Mode Error code
+    */    
+    virtual TTerminalModeErrorCode OnLaunchApp( TUint aAppId, RBuf8& aUrl, TUint aProfileId = 0 ) = 0;
+    /**
+    * Method to terminate an app that is already running.
+    * @param   aAppID	  The ID of the App as registered with the Terminal Mode Service.
+    * @param   aProfileId Profile ID of the client profile whose parameter settings will be 
+    *                     applied to the application during execution
+    * @return  Returns    Terminal Mode Error code
+    */    
+    virtual TTerminalModeErrorCode OnTerminateApp( TUint aAppId, TUint aProfileId = 0 ) = 0;
+    /**
+    * Method through which the Terminal Mode Service Service can retrieve the status of a
+	* given app. 
+    * @param	aAppID		The ID of the App as registered with the Terminal Mode Service.
+    * @param    aProfileId  [out]Profile ID of the client profile
+	* @param	aStatusType	[out]The App Status object to be populated
+	* @return   Returns Terminal Mode Error code
+    */    
+    virtual TTerminalModeErrorCode OnGetAppStatus( TUint aAppId, TUint& aProfileId ,RBuf8& aStatusType ) = 0;
+    /** 
+     * AutomotiveServer returns the the value of the state variable MaxNumProfiles 
+     * in response to the GetMaxNumProfiles action 
+     * @param aProfileIdCount[out] The maximum number of client profiles that are supported
+     *                              simultaneously by the TmClientProfile service. 
+     * @return   Returns TerminalModeError code                            
+     */
+    virtual TTerminalModeErrorCode OnGetMaxNumProfiles( TUint& aProfileIdCount ) = 0;
+    /** 
+     * Method to intimate AutomotiveServer whenever the control point invokes action to register 
+     * a client profile and notify the Terminal Mode device about its preferences, settings 
+     * and capabilities. 
+     * @param aProfileId The identifier of the profile record where the client profile 
+     *                   settings must be stored
+     * @param aClientProfile Profile information about Terminal Mode client and its capabilities
+     *                       which needs to be updated in the profile record    
+     * @param  aResultProfile[out]  The updated client profile.     
+     * @return  Returns Terminal Mode Error code                            
+     */
+    virtual TTerminalModeErrorCode OnSetClientProfile( TUint aProfileId, const TDesC8& aClientProfile, 
+                                                                          RBuf8& aResultProfile ) = 0;
+    /** 
+     * Method to intimate AutomotiveServer whenever the control point invokes action to 
+     * to access the contents of a client profile stored in the Terminal Mode device
+     * @param aProfileId The identifier of the profile record where the client profile 
+     *                   settings must be stored
+     * @param aClientProfile[out] Client profile corresponding to the profileID input variable 
+     * @return Returns  Terminal Mode Error code                                  
+     */
+    virtual TTerminalModeErrorCode OnGetClientProfile( TUint aProfileId, RBuf8& aClientProfile ) = 0;
+    /**
+     * Method to fetch the Terminal Mode Client( Car Kit )'s icon preferences from the 
+     * AutomotiveServer for a particular client profile corresponding to the profileID supplied.
+     * In case client profile has no icon preferences associated with it, AutomotiveServer 
+     * returns the Client Icon Preference object with default values.
+     * This method is invoked whenever the http request for a particular application icon 
+     * comes to Terminal Mode Service. 
+     * @param aProfileId   ProfileID corresponding to a particular client profile.
+     * @return  Returns reference to the Client Icon Preference object.
+     * @see  CUpnpTmClientIconPref
+     */
+    virtual const CUpnpTmClientIconPref& GetClientIconPrefsL( TUint aProfileId ) = 0;
+    };
+
+#endif // __UPNPTMSERVEROBSERVER_H__
+
--- a/upnp/upnpstack/controlpointbase/src/upnpcpbdescriptionagent.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/controlpointbase/src/upnpcpbdescriptionagent.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -215,7 +215,7 @@
             RBuf8 description;
             if(deviceDescription->UrlBase().Length()!=0)
                 {
-                description.Create(aDeviceDescPath.Length()+deviceDescription->UrlBase().Length());
+                description.CreateL(aDeviceDescPath.Length()+deviceDescription->UrlBase().Length());
                 description.Copy(deviceDescription->UrlBase());
                 TInt firstSlash(aDeviceDescPath.Locate( KSlash8()[0] ) );		
                 if(firstSlash==0)
@@ -228,7 +228,7 @@
             else
                 {
                 TBuf<25> ipBuf;
-                description.Create(KUrlMaxLength);
+                description.CreateL(KUrlMaxLength);
                 description.Copy(KHttp());
                 
                 aAddr.Output ( ipBuf);
--- a/upnp/upnpstack/controlpointbase/src/upnpcpbembeddeddevicedescription.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/controlpointbase/src/upnpcpbembeddeddevicedescription.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -300,7 +300,6 @@
 				    {
 					iResult = KErrNotFound;
 				    }
-
                 }
             }
         else
--- a/upnp/upnpstack/controlpointbase/src/upnpserviceinfo.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/controlpointbase/src/upnpserviceinfo.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -233,19 +233,19 @@
             {
             result = RUpnpGenaMessageFactory::SubscribeL(
                             subscribe, servAddress, aPath, timeoutBuf );
-           break;
+            break;
             }
         case EResubscription:
             {
             result = RUpnpGenaMessageFactory::ResubscribeL(
                             subscribe, servAddress, aPath, timeoutBuf );
-			break;
+            break;
             }
         case EUnSubscription:
             {
             result = RUpnpGenaMessageFactory::UnsubscribeL(
                             subscribe, servAddress, aPath);
-			break;
+            break;
             }
         default:
             {
@@ -253,16 +253,15 @@
             User::Leave(KErrArgument);
             break;
             }
+
         }
     if(result == NULL)
         {
         // To avoid Coverity FORWARD_NULL errors
         User::Leave(KErrArgument);
         }
-    
     result->SetType( aType );
     iSessionId = result->SessionId();
-
     return result;
     }
 
--- a/upnp/upnpstack/dlnawebserver/group/dlnawebserver.mmp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/dlnawebserver/group/dlnawebserver.mmp	Tue Aug 31 16:06:48 2010 +0300
@@ -87,7 +87,6 @@
 
 
 //Max file size related libs
-LIBRARY                    commonui.lib
 
 LIBRARY                    flogger.lib
 DEFFILE                    DLNAwebserver
--- a/upnp/upnpstack/dlnawebserver/src/upnphttpbuffer.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/dlnawebserver/src/upnphttpbuffer.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -87,7 +87,7 @@
 //
 void CUpnpHttpBuffer::ConstructL()
 	{
-	iBuffer.Create( 0 );
+	iBuffer.CreateL( 0 );
 	iChunkParser = CUpnpHttpChunkParser::NewL();
 	}
 
--- a/upnp/upnpstack/dlnawebserver/src/upnphttpchunkparser.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/dlnawebserver/src/upnphttpchunkparser.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -107,6 +107,7 @@
             {
             case EUnknown:
                 iContext = EHeader;
+                break;
             case EHeader:
                 interrupt = ParseHeader(aBuffer,aPos);
                 break;
--- a/upnp/upnpstack/dlnawebserver/src/upnphttpsession.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/dlnawebserver/src/upnphttpsession.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -1445,7 +1445,7 @@
 
     CUpnpHttpHeader* hdr = List->First();
 
-	if(hdr != NULL)
+    if(hdr != NULL)
 	{
 		HBufC8* newHeader = NULL;
 		newHeader = HBufC8::NewLC( KTransferPending801().Length() );
@@ -1456,6 +1456,7 @@
 
 		CleanupStack::PopAndDestroy( newHeader );
 	}
+
     msg->SetOutFilenameL( *iOutFilename );
     CleanupStack::Pop( msg );
     NotifyUpperLayerLD( msg );
--- a/upnp/upnpstack/dlnawebserver/src/upnptcpserver.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/dlnawebserver/src/upnptcpserver.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -330,7 +330,7 @@
                 #endif
 
                 CUpnpTcpSession* sess = ConnectionAcceptedL( iClientSocket );
-                iSessionList.Append( sess );
+                iSessionList.AppendL( sess );
 
                 }
             else
--- a/upnp/upnpstack/messagehandler/src/upnpipfiltering.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/messagehandler/src/upnpipfiltering.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -241,7 +241,7 @@
         }
 
     // create heap descriptor
-    iListBuf.Create( buf->Size() );
+    iListBuf.CreateL( buf->Size() );
     buf->Read( 0, iListBuf, buf->Size() );
 
     // clean up;
--- a/upnp/upnpstack/serviceframework/src/upnpdevice.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/serviceframework/src/upnpdevice.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -544,7 +544,7 @@
 
     for (TInt i = 0; i < iDeviceList.Count(); i++ )
         {
-        aDevices.Append( iDeviceList[i] );
+        TRAP_IGNORE(aDevices.AppendL( iDeviceList[i] ));
         iDeviceList[i]->GetAllDevices(aDevices);
         }
 
--- a/upnp/upnpstack/serviceframework/src/upnpdeviceimplementation.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/serviceframework/src/upnpdeviceimplementation.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 
 #include <e32math.h>
-#include <xmlengdom.h> 
+#include <xml/dom/xmlengdom.h> 
 
 #include <upnpdevicedescriptionstore.h>
 #include "upnpfileutils.h"
--- a/upnp/upnpstack/serviceframework/src/upnpdeviceimplementationbase.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/serviceframework/src/upnpdeviceimplementationbase.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 
 #include <e32math.h>
-#include <xmlengdom.h> 
+#include <xml/dom/xmlengdom.h> 
 
 #include "upnpfileutils.h"
 #include "upnpicon.h"
--- a/upnp/upnpstack/serviceframework/src/upnpdispatcherengine.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/serviceframework/src/upnpdispatcherengine.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -174,7 +174,7 @@
     // adds a new customer for CUpnpDispatcherEngine
     if ( iCustomers.Find( &aCustomer ) == KErrNotFound )
         {
-        iCustomers.Append( &aCustomer );
+        TRAP_IGNORE(iCustomers.AppendL( &aCustomer ));
         }
     }
 // -----------------------------------------------------------------------------
@@ -352,7 +352,7 @@
             CleanupClosePushL( currServs );
             for ( TInt j = 0; j < iDevs[i].iServiceCount; j++ )
                 {
-                currServs.Append( (const TUpnpService*)&iServs[servIndex+j] );
+                currServs.AppendL( (const TUpnpService*)&iServs[servIndex+j] );
                 }
             CleanupStack::Check(&currServs);
             servIndex += iDevs[i].iServiceCount;
@@ -366,7 +366,7 @@
             currServs.Reset();
             CleanupStack::Pop( &currServs );
 
-            iNewDevices.Append( device );
+            iNewDevices.AppendL( device );
             }
 
         delete[] iDevs;
@@ -542,7 +542,7 @@
         request->AddServices(array);
 
         CleanupStack::Pop(request);
-        iPendingRequests.Append(request);
+        iPendingRequests.AppendL(request);
         }
     }
 
@@ -693,7 +693,7 @@
         request->AddArgumentL( aString );
 
         CleanupStack::Pop(request);
-        iPendingRequests.Append(request);
+        iPendingRequests.AppendL(request);
         }
     }
 
@@ -837,7 +837,7 @@
             }
 
         CleanupStack::Pop(request);
-        iPendingRequests.Append(request);
+        iPendingRequests.AppendL(request);
         }
     }
 
--- a/upnp/upnpstack/serviceframework/src/upnpsilentdeviceimplementation.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/serviceframework/src/upnpsilentdeviceimplementation.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 
 #include <e32math.h>
-#include <xmlengdom.h> 
+#include <xml/dom/xmlengdom.h> 
 
 #include <upnpdevicedescriptionstore.h>
 #include "upnpfileutils.h"
--- a/upnp/upnpstack/serviceframework/src/upnpsoapmessagefactory.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/serviceframework/src/upnpsoapmessagefactory.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -217,7 +217,6 @@
     
     CUpnpHttpHeader* hdr = hdrList->First();
     
-    
     while ( hdr )
     {
      TBool flag = EFalse;
--- a/upnp/upnpstack/upnphttptransfer/src/httpfile.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/upnphttptransfer/src/httpfile.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -231,7 +231,7 @@
             }
         }
 
-    iHeaderArray.Append( CHttpHeader::NewL( aFieldName, aFieldValue ) );
+     iHeaderArray.AppendL( CHttpHeader::NewL( aFieldName, aFieldValue ) );
     }
 
 // --------------------------------------------------------------------------
--- a/upnp/upnpstack/upnputils/src/upnpdevicelibrary.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/upnputils/src/upnpdevicelibrary.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -631,7 +631,7 @@
                 element->SetRenew(CUpnpTimeoutElement::EOnce);
                 element->SetTimeout(aMessage->CacheControl());
                 element->SetLocal(EFalse);
-                iElementArray.Append(element);
+                iElementArray.AppendL(element);
                 
                 CleanupStack::Pop(); // element
                 }
@@ -662,7 +662,7 @@
                     element->SetRenew(CUpnpTimeoutElement::EOnce);
                     element->SetTimeout(aMessage->CacheControl());
                     element->SetLocal(EFalse);
-                    iElementArray.Append(element);
+                    iElementArray.AppendL(element);
                 
                     CleanupStack::Pop(); // element
                     }
@@ -679,7 +679,7 @@
         element->SetRenew(CUpnpTimeoutElement::EOnce);
         element->SetTimeout(aMessage->CacheControl());
         element->SetLocal(EFalse);
-        iElementArray.Append(element);
+        iElementArray.AppendL(element);
         
         CleanupStack::Pop(); // element
         }
--- a/upnp/upnpstack/upnputils/src/upnpdominterface.cpp	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack/upnputils/src/upnpdominterface.cpp	Tue Aug 31 16:06:48 2010 +0300
@@ -30,9 +30,9 @@
 #include "upnpcustomlog.h"
 
 
-#include <xmlengdom.h>
-#include <xmlengdocument.h>
-#include <xmlengserializationoptions.h>
+#include <xml/dom/xmlengdom.h>
+#include <xml/dom/xmlengdocument.h>
+#include <xml/dom/xmlengserializationoptions.h>
 
 
 
--- a/upnp/upnpstack_plat/upnp_device_api/inc/upnpdevicedescriptionstore.h	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack_plat/upnp_device_api/inc/upnpdevicedescriptionstore.h	Tue Aug 31 16:06:48 2010 +0300
@@ -20,9 +20,9 @@
 #define C_CUPNPDEVICEDESCRIPTIONSTORE_H
 
 #include <e32base.h> 
-#include <xmlengdom.h> 
-#include <xmlengdocument.h>
-#include <xmlengdomparser.h>
+#include <xml/dom/xmlengdom.h> 
+#include <xml/dom/xmlengdocument.h>
+#include <xml/dom/xmlengdomparser.h>
 #include <upnpicon.h>
 
 class CUpnpDevice;
--- a/upnp/upnpstack_plat/upnp_utils_api/inc/upnpdominterface.h	Mon Mar 15 12:43:29 2010 +0200
+++ b/upnp/upnpstack_plat/upnp_utils_api/inc/upnpdominterface.h	Tue Aug 31 16:06:48 2010 +0300
@@ -26,7 +26,7 @@
 #include <f32file.h>
 #include <s32file.h>
 #include <utf.h>
-#include <xmlengdom.h>
+#include <xml/dom/xmlengdom.h>
 
 namespace UpnpDomInterface
     {